This commit is contained in:
corn
2026-06-07 22:59:32 +08:00
commit a62ff7379b
7171 changed files with 10015624 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
using UnityEngine.Audio;
using System;
using UnityEngine;
public class AudioManager : MonoBehaviour
{
public static AudioManager instance;
public AudioMixerGroup mixerGroup;
public Sound[] sounds;
int hitNo = 0;
void Awake()
{
if (instance != null)
{
Destroy(gameObject);
}
else
{
instance = this;
DontDestroyOnLoad(gameObject);
}
foreach (Sound s in sounds)
{
s.source = gameObject.AddComponent<AudioSource>();
s.source.clip = s.clip;
s.source.loop = s.loop;
s.source.outputAudioMixerGroup = mixerGroup;
}
}
private void Start()
{
}
public void HitMethod()
{
Play("hit" + hitNo);
if(hitNo<=4)
{
hitNo++;
}else
{
hitNo = 0;
}
}
public void Play(string sound)
{
Sound s = Array.Find(sounds, item => item.name == sound);
if (s == null)
{
Debug.LogWarning("Sound: " + name + " not found!");
return;
}
s.source.volume = s.volume * (1f + UnityEngine.Random.Range(-s.volumeVariance / 2f, s.volumeVariance / 2f));
s.source.pitch = s.pitch * (1f + UnityEngine.Random.Range(-s.pitchVariance / 2f, s.pitchVariance / 2f));
s.source.Play();
}
public void Pause(string sound)
{
Sound s = Array.Find(sounds, item => item.name == sound);
if (s == null)
{
Debug.LogWarning("Sound: " + name + " not found!");
return;
}
s.source.volume = s.volume * (1f + UnityEngine.Random.Range(-s.volumeVariance / 2f, s.volumeVariance / 2f));
s.source.pitch = s.pitch * (1f + UnityEngine.Random.Range(-s.pitchVariance / 2f, s.pitchVariance / 2f));
s.source.Pause();
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 55baf601046ec054c94f3742ed8d3515
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Board : MonoBehaviour
{
public static Board instance;
private void Awake()
{
instance = this;
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3d7c3ae434c488e429ff80c491101028
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,73 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UIElements;
public class Bolt : MonoBehaviour
{
public static Bolt instance;
public enum states
{
Null,
idle,
select,
done
}
public states boltstate;
public Transform originalTransform;
public Vector3 pos;
public List<CharacterJoint> connectedJoints;
public CharacterJoint otherObject;
public Vector3 offset;
public bool touch;
private void Awake()
{
instance = this;
}
void Start()
{
originalTransform = gameObject.transform;
pos = transform.localPosition;
//print(pos);
//boltstate = states.idle;
}
void Update()
{
}
private void OnMouseDrag()
{
if (boltstate == states.select)
{
transform.position = (Mousepos() + offset);
}
}
private void OnMouseDown()
{
if (boltstate == states.select)
{
offset = transform.position - Mousepos();
}
}
Vector3 Mousepos()
{
var mouseScreenPos = Input.mousePosition;
mouseScreenPos.z = Camera.main.WorldToScreenPoint(transform.position).z;
return Camera.main.ScreenToWorldPoint(mouseScreenPos);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0e6a43f0406a425468073110567f3b2c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,98 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class Cameramove : MonoBehaviour
{
public static Cameramove Instance;
public Transform originalpos;
public Transform changePos;
public Transform FailCam;
public DOTweenAnimation Animalanim;
public Transform wedcam;
private void Awake()
{
Instance = this;
}
void Start()
{
//originalpos = transform;
if ((GameManager.instance.gamemodes == GameManager.Modes.Wednesday))
{
transform.DOMove(wedcam.position, 2f).SetEase(Ease.Linear).OnComplete(() =>
{
DOVirtual.DelayedCall(1f, () =>
{
FirstChange();
});
});
}
else
{
DOVirtual.DelayedCall(3f, () =>
{
FirstChange();
});
}
}
// Update is called once per frame
void Update()
{
}
public void FirstChange()
{
transform.DOMove(changePos.position, 2.5f).OnComplete(() =>
{
TouchDrop.instance.start = true;
});
transform.rotation = changePos.transform.rotation;
GameManager.instance.test = true;
}
// ReSharper disable Unity.PerformanceAnalysis
public void SecondChange()
{
transform.DOMove(originalpos.position, 2.5f).OnComplete(() =>
{
GameManager.instance.DoorOpen();
});
transform.rotation = originalpos.rotation;
}
public void fail()
{
/*GameManager.instance.Animal.GetComponent<Animator>().SetTrigger("Fail");
GameManager.instance.Animal.transform.DORotate(new Vector3(0, -90, 0), 0.01f,RotateMode.LocalAxisAdd).SetEase(Ease.Linear).OnComplete(
() =>
{
transform.DOMove(FailCam.position, 1.5f);
transform.rotation = FailCam.rotation;
});*/
if (GameManager.instance.gamemodes == GameManager.Modes.Pig || GameManager.instance.gamemodes == GameManager.Modes.Kingkong )
{
transform.DOMove(FailCam.position, 1.5f).OnComplete(() =>
{
//Animalanim.DOPlay();
GameManager.instance.Animal.GetComponent<Animator>().SetTrigger("Fail");
});
transform.rotation = FailCam.rotation;
}
/*transform.DOMove(FailCam.position, 1.5f).OnComplete(() =>
{
//Animalanim.DOPlay();
GameManager.instance.Animal.transform.DORotate(new Vector3(0, -90, 0), 0.01f,RotateMode.LocalAxisAdd).SetEase(Ease.Linear);
GameManager.instance.Animal.GetComponent<Animator>().SetTrigger("Fail");
});
transform.rotation = FailCam.rotation;*/
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dd03b6c6513b5f544baad69103a3d48c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections;
using System.Collections.Generic;
//using Unity.VisualScripting;
using UnityEngine;
public class Finish : MonoBehaviour
{
public static Finish instance;
public ParticleSystem blast;
private void Awake()
{
instance = this;
}
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.CompareTag("CUBE"))
{
GameManager.instance.donecount++;
if (other.gameObject.GetComponentInChildren<Rigidbody>().isKinematic == true)
{
other.gameObject.GetComponentInChildren<Rigidbody>().isKinematic = false;
}
Destroy(other.gameObject.GetComponent<Rigidbody2D>());
Destroy(other.gameObject.GetComponent<PolygonCollider2D>());
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ecea9d7a945f7934d82314ed18dc93f9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,470 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using Dreamteck.Splines;
//using Unity.VisualScripting;
using UnityEngine.Serialization;
using UnityEngine.UI;
public class GameManager : MonoBehaviour
{
public static GameManager instance;
public enum Modes
{
Null,
Tiger,
BirdsCats,
Elephant,
Wednesday,
Pig,
Kingkong,
KingKong1,
Dogs,
}
public Modes gamemodes;
public enum State
{
Null,
Idle,
Select,
Done,
}
public State gamestate;
[Header("Bolt Ui Move")] public List<GameObject> selected;
public List<GameObject> doneObjects;
public GameObject uiimage;
[Header("Bolt Shifting")] public List<GameObject> selectedBolt;
public GameObject dupPlug;
public GameObject dupcolider;
public int totalcount;
public int donecount;
/*public GameObject keyparticle;
public GameObject lockparticle;*/
public GameObject fillPartical;
[Header("ANIMAL")] public bool animal;
public GameObject Animal;
public GameObject AnimalMovePos;
public GameObject thief;
public GameObject player;
public SplineComputer playerspline;
[Header("Birds or cats")]
public bool Birds;
public bool cats;
public bool Dogs,Rabbit,Fox,Zebra,Dear,Flamingo;
public List<GameObject> birds;
public List<DOTweenAnimation> birdsanim;
public List<GameObject> birds2;
public List<DOTweenAnimation> birdsanim2;
public GameObject cagedoor;
public bool keycollect;
public bool test;
public GameObject policeMan;
public GameObject sleepeffect;
public bool Fail;
private void Awake()
{
instance = this;
}
void Start()
{
gamestate = State.Done;
if (Board.instance)
{
transform.position = Board.instance.transform.position;
}
dupcolider.GetComponent<CircleCollider2D>().enabled = false;
//Vibration.Init();
}
public bool once;
void Update()
{
if (totalcount == donecount /*|| test*/)
{
if (!UIManager.INSTANCE.win && gamemodes==Modes.Null)
{
winning();
}
if (gamemodes == Modes.BirdsCats || gamemodes==Modes.Dogs)
{
/*if (test && !once)
{
once = true;
Cameramove.Instance.SecondChange();
}*/
if (totalcount == donecount && !once)
{
Cameramove.Instance.SecondChange();
once = true;
//keycollect = false;
//AnimalAnimation();
}
}
if ((gamemodes == Modes.Tiger || gamemodes == Modes.Elephant || gamemodes==Modes.Pig) && !once)
{
Cameramove.Instance.SecondChange();
//TigerAttack();
once = true;
DOVirtual.DelayedCall(4.2f, () =>
{
StartCoroutine(policechasewait());
});
}
if (gamemodes == Modes.Wednesday && !once)
{
Cameramove.Instance.SecondChange();
once = true;
}
if (gamemodes == Modes.Kingkong && !once)
{
once = true;
Cameramove.Instance.SecondChange();
}
if (gamemodes == Modes.KingKong1 && !once)
{
once = true;
Cameramove.Instance.SecondChange();
DOVirtual.DelayedCall(4.2f, () =>
{
if (AudioManager.instance)
{
AudioManager.instance.Play("KingKong");
}
StartCoroutine(policechasewait());
});
}
/*if ((gamemodes != Modes.Null && !UIManager.INSTANCE.win) && !once)
{
once = true;
Cameramove.Instance.SecondChange();
DOVirtual.DelayedCall(4.5f, () =>
{
StartCoroutine(policechasewait());
});
}*/
}
if (Fail && !once)
{
Cameramove.Instance.fail();
once = true;
}
}
public void winning()
{
Finish.instance.blast.Play();
AudioManager.instance.Play("Win");
UIManager.INSTANCE.win = true;
UIManager.INSTANCE.Winpanel();
}
public void TigerAttack()
{
Animal.gameObject.GetComponent<Animator>().SetTrigger("Walk");
Animal.transform.DOMove(new Vector3(0, Animal.transform.position.y, 0.5f), 1.5f).SetEase(Ease.Linear);
DOVirtual.DelayedCall(1.25f, () =>
{
Animal.transform.DOLocalRotate(new Vector3(0, 0, -65), 0.1f, RotateMode.LocalAxisAdd)
.SetEase(Ease.Linear);
});
DOVirtual.DelayedCall(1.5f,() =>
{
Animal.transform.DOMove(new Vector3(thief.transform.localPosition.x-0.5f, Animal.transform.position.y, thief.transform.localPosition.z+1.5f), 1f).SetEase(Ease.Linear).OnUpdate(
() =>
{
Animal.gameObject.GetComponent<Animator>().SetTrigger("Attack");
player.GetComponent<Animator>().SetTrigger("Run");
player.GetComponent<SplineFollower>().enabled = true;
player.GetComponent<SplineFollower>().spline = playerspline;
DOVirtual.DelayedCall(0.4f, () =>
{
thief.GetComponent<Animator>().SetTrigger("Fall");
});
});
});
if (!UIManager.INSTANCE.win)
{
DOVirtual.DelayedCall(5f, () =>
{
winning();
});
}
}
public void DoorOpen()
{
//cagedoor.GetComponent<DOTweenAnimation>().DOPlay();
if (gamemodes == Modes.Kingkong)
{
cagedoor.GetComponent<Rigidbody>().isKinematic = false;
KingKong.instance.kingkongfun();
}
else
{
if (AudioManager.instance)
{
AudioManager.instance.Play("Door");
}
cagedoor.transform.DOLocalRotate(new Vector3(0, -120f, 0), 1f,RotateMode.LocalAxisAdd).SetEase(Ease.Linear).OnComplete(
() =>
{
if (gamemodes == Modes.Tiger)
{
AudioManager.instance.Play("Cheetah");
}
AnimalAnimation();
});
}
}
public void AnimalAnimation()
{
if (gamemodes == Modes.Tiger)
{
TigerAttack();
}
if (gamemodes==Modes.BirdsCats || gamemodes==Modes.Dogs)
{
birdscats();
}
if (gamemodes == Modes.Wednesday)
{
Wednesday.instance.weddone();
print("Wednesday");
}
if (gamemodes==Modes.Elephant)
{
Animal.GetComponent<Animator>().SetTrigger("Run");
DOVirtual.DelayedCall(0.3f, () =>
{
if (AudioManager.instance)
{
AudioManager.instance.Play("Elephant");
}
Animal.GetComponent<DOTweenAnimation>().DOPlay();
});
//seq.AppendInterval(0.3f);
}
if (gamemodes == Modes.Pig)
{
Animal.GetComponent<Animator>().SetTrigger("Run");
Animal.transform.DOMoveY(Animal.transform.position.y-1.5f,0.02f);
DOVirtual.DelayedCall(0.3f, () =>
{
if (AudioManager.instance)
{
AudioManager.instance.Play("Pig");
}
Animal.GetComponent<DOTweenAnimation>().DOPlay();
});
}
if (gamemodes == Modes.KingKong1)
{
Animal.GetComponent<Animator>().SetTrigger("Run");
Animal.transform.DOMoveY(Animal.transform.position.y-0.5f,0.02f);
DOVirtual.DelayedCall(0.3f, () =>
{
Animal.GetComponent<DOTweenAnimation>().DOPlay();
});
}
}
public void birdscats()
{
if (birds.Count != null)
{
if (AudioManager.instance)
{
if (Birds)
{
AudioManager.instance.Play("Birds");
}
if (cats)
{
AudioManager.instance.Play("Cats");
}
if (Dogs)
{
AudioManager.instance.Play("Dogs");
}
if (Flamingo)
{
AudioManager.instance.Play("Flamingo");
}
if (Rabbit)
{
AudioManager.instance.Play("Rabbit");
}
if (Zebra)
{
AudioManager.instance.Play("Zebra");
}
}
for (int i = 0; i < birds.Count; i++)
{
birds[i].GetComponent<Animator>().SetTrigger("Fly");
if (Birds)
{
birds[i].transform
.DOMove(
new Vector3((float)UnityEngine.Random.Range(-1.14f, 1.14f),
(float)UnityEngine.Random.Range(-4f, 0f), UnityEngine.Random.Range(-1f, -0.3f)),
UnityEngine.Random.Range(0.3f, 0.7f)).SetEase(Ease.Linear).OnComplete(() =>
{
foreach (var t in birdsanim)
{
t.DOPlay();
}
});
if (birds2.Count == 0)
{
StartCoroutine(policechasewait());
}
}
if (cats || Dogs || Rabbit || Fox || Zebra || Dear || Flamingo)
{
birds[i].transform
.DOMove(
new Vector3((float)UnityEngine.Random.Range(-1.14f, 1.14f),
(float)UnityEngine.Random.Range(-4f, -3f), UnityEngine.Random.Range(-1f, -0.3f)),
UnityEngine.Random.Range(0.3f, 0.7f)).SetEase(Ease.Linear).OnComplete(() =>
{
foreach (var t in birdsanim)
{
t.DOPlay();
}
});
if (birds2.Count == 0)
{
StartCoroutine(policechasewait());
}
}
}
}
if (birds2.Count != null)
{
if (AudioManager.instance)
{
if (Birds)
{
AudioManager.instance.Play("Birds");
}
/*if (cats)
{
AudioManager.instance.Play("Cats");
}*/
}
for (int i = 0; i < birds2.Count; i++)
{
birds2[i].GetComponent<Animator>().SetTrigger("Fly");
if (Birds)
{
birds2[i].transform
.DOMove(
new Vector3((float)UnityEngine.Random.Range(-1.14f, 1.14f),
(float)UnityEngine.Random.Range(-4f, 0f), UnityEngine.Random.Range(-1f, -0.3f)),
UnityEngine.Random.Range(0.5f, 1f)).SetEase(Ease.Linear).OnComplete(() =>
{
foreach (var t in birdsanim2)
{
t.DOPlay();
}
});
StartCoroutine(policechasewait());
}
if (cats || Dogs || Rabbit || Fox || Zebra || Dear || Flamingo)
{
birds2[i].transform
.DOMove(
new Vector3((float)UnityEngine.Random.Range(-1.14f, 1.14f),
(float)UnityEngine.Random.Range(-4f, -3f), UnityEngine.Random.Range(-1f, -0.3f)),
UnityEngine.Random.Range(0.5f, 1f)).SetEase(Ease.Linear).OnComplete(() =>
{
foreach (var t in birdsanim2)
{
t.DOPlay();
}
});
StartCoroutine(policechasewait());
}
}
}
keycollect = false;
}
public void BirdsPoliceChase()
{
policeMan.GetComponent<Animator>().SetTrigger("Chase");
}
public void BirdsPolicemove()
{
if (AudioManager.instance)
{
AudioManager.instance.Play("Police");
}
policeMan.GetComponent<DOTweenAnimation>().DOPlay();
DOVirtual.DelayedCall(3f, () =>
{
winning();
});
}
IEnumerator policechasewait()
{
sleepeffect.SetActive(false);
BirdsPoliceChase();
yield return new WaitForSeconds(1.8f);
BirdsPolicemove();
}
public void vibration()
{
//Vibration.Vibrate(40);
print("vibrate");
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 11a57b8a6c530784eb8197e79cf7f716
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class Key : MonoBehaviour
{
public static Key instance;
public GameObject locking;
public GameManager gamemanager;
private void Awake()
{
instance = this;
}
void Start()
{
gamemanager=GameManager.instance;
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("CUBE"))
{
gameObject.GetComponent<Collider>().enabled = false;
gameObject.transform.GetComponentInChildren<DOTweenAnimation>().DOComplete();
if (AudioManager.instance)
{
gamemanager.vibration();
AudioManager.instance.Play("Key");
gamemanager.keycollect = true;
}
gameObject.transform.DOMove(locking.gameObject.transform.position, 0.5f).OnComplete(() =>
{
transform.GetComponentInChildren<MeshRenderer>().enabled = false;
if (AudioManager.instance)
{
AudioManager.instance.Play("Lock");
gamemanager.vibration();
}
locking.GetComponentInChildren<DOTweenAnimation>().DOPlay();
if (!locking.transform.GetComponentInChildren<ParticleSystem>().isPlaying)
{
locking.transform.GetComponentInChildren<ParticleSystem>().Play();
}
});
}
}
public void Locked()
{
locking.transform.parent.GetChild(1).tag = "BOLT";
transform.gameObject.SetActive(false);
locking.transform.SetParent(null);
locking.GetComponent<Rigidbody>().isKinematic = false;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1d4c5ec5d40188c4aab31a4b45a032c3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBolt : MonoBehaviour
{
public GameObject connectedBody;
public List<GameObject> connectedBodylist;
public List<GameObject> previousbodies = new List<GameObject>();
public GameManager gamemanger;
void Start()
{
gamemanger=GameManager.instance;
}
// Update is called once per frame
void Update()
{
}
private void OnTriggerStay(Collider other)
{
if (other.gameObject.CompareTag("CUBE"))
{
if (gamemanger.gamestate == GameManager.State.Idle)
{
if (!connectedBodylist.Contains(other.gameObject))
{
connectedBodylist.Add(other.gameObject);
}
}
}
}
private void OnTriggerExit(Collider other)
{
if (other.gameObject.CompareTag("CUBE"))
{
if (connectedBodylist.Contains(other.gameObject))
{
connectedBodylist.Remove(other.gameObject);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 75797e63c6691234fa9fa8c1d3fcae37
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 236c0b35f1eaf83479f53c87761a63b3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using com.adjust.sdk;
public class AdjustManager : MonoBehaviour
{
public string id = "qoy21u10cvsw";
public void InitAdjust()
{
AdjustConfig adjustConfig = new AdjustConfig(id, AdjustEnvironment.Production,true);
adjustConfig.setLogLevel(AdjustLogLevel.Info);
adjustConfig.setSendInBackground(true);
new GameObject("Adjust").AddComponent<Adjust>();
Adjust.addSessionCallbackParameter("foo", "bar");
adjustConfig.setAttributionChangedDelegate((adjustAttribution) =>
{
Debug.LogFormat("Adjust Attribution Callback: ", adjustAttribution.trackerName);
});
Adjust.start(adjustConfig);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c521e771fec00f148b01ca5cc3e0b939
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,53 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using GameAnalyticsSDK;
using UnityEngine.EventSystems;
public class GAScript : MonoBehaviour
{
public static GAScript Instance;
private void Awake()
{
if (!Instance)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
DestroyImmediate(gameObject);
}
// Vibration.Init();
Init();
}
private void Init()
{
// GA
// GameAnalytics.Initialize();
}
public static void LevelStart(int levelname, int levelAttempts)
{
// GameAnalytics.NewProgressionEvent(GAProgressionStatus.Start, levelname.ToString());
print("Start::" + levelname);
//FaceBookScript.instance.LevelStarted(levelname);
}
public static void LevelFail(int levelName, int levelAttempts)
{
// GameAnalytics.NewProgressionEvent(GAProgressionStatus.Fail, levelName.ToString());
print("Failed::" + levelName);
// FaceBookScript.instance.LevelFailed(levelname);
}
public static void LevelCompleted(int levelName, int levelAttempts)
{
// GameAnalytics.NewProgressionEvent(GAProgressionStatus.Complete, levelName.ToString());
print("Completed::" + levelName);
// FaceBookScript.instance.LevelCompleted(levelname);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8c281260e5a0ad14ebb280d7a24a8d61
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//using LionStudios.Suite.Analytics;
public class LionStudiosManager : MonoBehaviour
{
public static LionStudiosManager instance;
private void Awake()
{
instance = this;
}
//public static void LionInit() => LionAnalytics.GameStart();
public static void LevelStart(int levelNo, int attemptNum, int? score = null)
{
//LionAnalytics.LevelStart(levelNo, attemptNum, score);
}
public static void LevelComplete(int levelNo, int attemptNum, int? score = null)
{
//LionAnalytics.LevelComplete(levelNo, attemptNum, score);
}
public static void LevelFail(int levelNo, int attemptNum, int? score = null)
{
//LionAnalytics.LevelFail(levelNo, attemptNum, score);
}
public static void LevelRestart(int levelNo, int attemptNum, int? score = null)
{
//LionAnalytics.LevelRestart(levelNo, attemptNum, score);
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 100c9fa3d346a4848bb3e2ae45df6393
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,28 @@
using UnityEngine.Audio;
using UnityEngine;
[System.Serializable]
public class Sound {
public string name;
public AudioClip clip;
[Range(0f, 1f)]
public float volume = .75f;
[Range(0f, 1f)]
public float volumeVariance = .1f;
[Range(.1f, 3f)]
public float pitch = 1f;
[Range(0f, 1f)]
public float pitchVariance = .1f;
public bool loop = false;
public AudioMixerGroup mixerGroup;
[HideInInspector]
public AudioSource source;
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 087cabc5ed1a99847bc865c76a6f1af3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,97 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using UnityEngine.UI;
public class TouchBolt : MonoBehaviour
{
public static TouchBolt instance;
private RaycastHit _hit;
[Header("Scripts")]
public GameManager gameManager;
private Vector3 offset;
public Image BoltImage;
public GameObject selectedBolt;
private void Awake()
{
instance = this;
}
void Start()
{
gameManager=GameManager.instance;
}
void Update()
{
if (Input.GetMouseButtonDown(0))
{
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out _hit))
{
if (_hit.collider.gameObject.CompareTag("BOLT"))
{
var selectObject = _hit.collider.gameObject;
//boltfunction(selectObject);-----------------------Select and move object-----------
boltuifunction(selectObject);
}
}
}
}
public void boltuifunction(GameObject selectobj)
{
selectobj.GetComponent<Collider>().enabled = false;
GameObject image = gameManager.uiimage;
Vector3 movePos;
RectTransformUtility.ScreenPointToWorldPointInRectangle(image.GetComponent<RectTransform>(), image.GetComponent<RectTransform>().position, Camera.main, out movePos);
movePos.z = selectobj.transform.GetChild(0).transform.localPosition.z;
selectobj.transform.GetChild(0).transform.DOMove(movePos, 2f).OnComplete(() =>
{
selectobj.transform.GetChild(0).gameObject.SetActive(false);
selectobj.GetComponent<Bolt>().boltstate = Bolt.states.done;
});
//selectobj.transform.position = movePos;
for (int i = 0; i < selectobj.GetComponent<Bolt>().connectedJoints.Count; i++)
{
//selectobj.GetComponent<Bolt>().connectedJoints[i].GetComponent<Collider>().isTrigger = true;
Destroy(selectobj.GetComponent<Bolt>().connectedJoints[i]);
}
}
public void boltfunction(GameObject selectedbolt)
{
if (gameManager.selected.Count == 0)
{
if (selectedbolt.GetComponent<Bolt>().boltstate != Bolt.states.select)
{
selectedbolt.transform.DOLocalMoveZ(selectedbolt.transform.localPosition.z - 0.013f, 0.3f);
gameManager.selected.Add(selectedbolt);
selectedbolt.GetComponent<Bolt>().boltstate = Bolt.states.select;
}
}
if (gameManager.selected.Count == 1)
{
if ((selectedbolt.GetComponent<Bolt>().boltstate != Bolt.states.select))
{
gameManager.selected[0].transform
.DOLocalMove(gameManager.selected[0].GetComponent<Bolt>().pos, 0.3f).SetEase(Ease.Linear);
selectedbolt.transform.DOLocalMoveZ(selectedbolt.transform.localPosition.z - 0.013f, 0.3f);
gameManager.selected.RemoveAt(0);
gameManager.selected.Add(selectedbolt);
selectedbolt.GetComponent<Bolt>().boltstate = Bolt.states.select;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 250e708dbf4df294582fce235a5fe13c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,358 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using UnityEngine;
using DG.Tweening;
using UnityEngine.UI;
public class TouchDrop : MonoBehaviour
{
public static TouchDrop instance;
[SerializeField] public bool start;
private RaycastHit _hit;
[Header("Scripts")]
public GameManager gameManager;
public float boltremoveheight;
private Vector3 offset;
//public int touchcount;
public bool blocking;
public GameObject Block1;
public GameObject Block2;
public AudioManager audioManager;
private void Awake()
{
instance = this;
boltremoveheight = 2f;
}
void Start()
{
gameManager=GameManager.instance;
if (AudioManager.instance)
{
audioManager = AudioManager.instance;
}
if (gameManager.gamemodes == GameManager.Modes.Null)
{
start = true;
}
}
void Update()
{
/*if (blocking && Block1.GetComponent<Rigidbody2D>())
{
Block1.GetComponent<Rigidbody2D>().simulated = true;
}
/*if (!blocking)
{
Block1.GetComponent<Rigidbody2D>().simulated = false;
}#1#*/
if (Input.GetMouseButtonDown(0))
{
if (!UIManager.INSTANCE.win && start)
{
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out _hit))
{
if (_hit.collider.gameObject.CompareTag("BOLT"))
{
if (gameManager.gamestate == GameManager.State.Done)
{
var selectObject = _hit.collider.gameObject;
Boltshifting(selectObject);
}
}
if (_hit.collider.gameObject.CompareTag("Fill"))
{
if (gameManager.gamestate == GameManager.State.Done)
{
var fillingplace = _hit.collider.gameObject;
Filling(fillingplace);
print(" "+_hit.collider.gameObject.name);
}
}
}
}
}
}
// ReSharper disable Unity.PerformanceAnalysis
public void Filling(GameObject fillingreferance)
{
/*if (gameManager.selectedBolt.Count == 1)
{
if (UIManager.INSTANCE.fill)
{
UIManager.INSTANCE.fill = false;
}
var position1 = fillingreferance.transform.position;
var gameobj = gameManager.selectedBolt[0].GetComponentInChildren<CapsuleCollider>().gameObject;
gameManager.vibration();
gameManager.selectedBolt[0].GetComponentInParent<NewBolt>().enabled = false;
//print(gameManager.selectedBolt[0].transform.parent.name);
var position = position1;
/////make lists equal
if (gameManager != null && gameManager.selectedBolt[0].GetComponent<NewBolt>().previousbodies.Count != null)
{
gameManager.selectedBolt[0].GetComponent<NewBolt>().previousbodies.Clear();
/*if (gameManager.selectedBolt[0].GetComponent<NewBolt>().connectedBodylist.Count != null)
{
for (int i = 0; i < gameManager.selectedBolt[0].GetComponent<NewBolt>().connectedBodylist.Count; i++)
{
gameManager.selectedBolt[0].GetComponent<NewBolt>().previousbodies.Add(gameManager.selectedBolt[0].GetComponent<NewBolt>().connectedBodylist[i]);
}
}#1#
}
if (gameManager != null && gameManager.selectedBolt[0].GetComponent<NewBolt>().connectedBodylist.Count != null)
{
for (int i = 0; i < gameManager.selectedBolt[0].GetComponent<NewBolt>().connectedBodylist.Count; i++)
{
gameManager.selectedBolt[0].GetComponent<NewBolt>().connectedBodylist[i].GetComponentInParent<Rigidbody2D>().simulated = false;
}
gameobj.GetComponent<Collider>().enabled = false;
/*Instantiate(gameManager.fillPartical, new Vector3(position1.x,position1.y,position1.z - 1.5f),
new Quaternion(0f,0f,0f,0f));#1#
for (int i = 0; i < gameManager.selectedBolt[0].GetComponent<NewBolt>().connectedBodylist.Count; i++)
{
gameManager.selectedBolt[0].GetComponent<NewBolt>().previousbodies.Add(gameManager.selectedBolt[0].GetComponent<NewBolt>().connectedBodylist[i]);
}
}
gameManager.selectedBolt[0].GetComponent<NewBolt>().connectedBodylist.Clear();
gameManager.selectedBolt[0].transform.parent.DOMoveX(position.x, 0.25f);
gameManager.selectedBolt[0].transform.parent.DOMoveY(position.y, 0.25f).SetEase(Ease.Linear).OnComplete(() =>
{
audioManager.Play("Fill");
//gameManager.selectedBolt[0].GetComponentInParent<CircleCollider2D>().enabled = true;
Instantiate(gameManager.fillPartical, new Vector3(position1.x,position1.y,position1.z - 1.5f),
new Quaternion(0f,0f,0f,0f));
gameManager.selectedBolt[0].transform.parent.transform.DOLocalMoveZ(
gameManager.selectedBolt[0].transform.parent.transform.localPosition.z + boltremoveheight, 0.3f)
.SetEase(Ease.Linear)/*.OnComplete(() =>
{
gameManager.selectedBolt[0].GetComponentInParent<CircleCollider2D>().enabled = true;
})#1#;
if (gameManager.selectedBolt[0].GetComponent<NewBolt>().previousbodies != null)
{
for (int i = 0; i < gameManager.selectedBolt[0].GetComponent<NewBolt>().previousbodies.Count; i++)
{
gameManager.selectedBolt[0].GetComponent<NewBolt>().previousbodies[i]
.GetComponentInParent<Rigidbody2D>().simulated = true;
}
gameobj.GetComponent<Collider>().enabled = true;
gameManager.selectedBolt.Clear();
}
else
{
gameManager.selectedBolt.Clear();
}
});
}*/
if (gameManager.dupPlug!=null)
{
if (UIManager.INSTANCE.fill)
{
UIManager.INSTANCE.fill = false;
}
gameManager.vibration();
var parent = gameManager.dupPlug.transform.parent;
var position1 = fillingreferance.transform.position;
gameManager.dupcolider.transform.localPosition = parent.transform.localPosition;
gameManager.dupcolider.GetComponent<CircleCollider2D>().enabled = true;
parent.GetComponent<CircleCollider2D>().enabled = false;
//gameManager.dupPlug.GetComponentInParent<NewBolt>().enabled = false;
//gameManager.dupPlug.GetComponent<NewBolt>().connectedBodylist.Clear();
parent.DOMoveX(position1.x, 0.25f);
parent.DOMoveY(position1.y, 0.25f).SetEase(Ease.Linear).OnComplete(() =>
{
audioManager.Play("Fill");
Instantiate(gameManager.fillPartical, new Vector3(position1.x,position1.y,position1.z - 1.5f),
new Quaternion(0f,0f,0f,0f));
parent.transform.DOLocalMoveZ(
parent.transform.localPosition.z + boltremoveheight, 0.3f)
.SetEase(Ease.Linear).OnComplete(() =>
{
gameManager.dupcolider.GetComponent<CircleCollider2D>().enabled = false;
parent.GetComponent<CircleCollider2D>().enabled = true;
gameManager.gamestate = GameManager.State.Done;
});
});
gameManager.dupPlug = null;
}
}
// ReSharper disable Unity.PerformanceAnalysis
public void Boltshifting(GameObject boltreferance)
{
if (gameManager.dupPlug!=null)
{
gameManager.vibration();
audioManager.Play("Bolt");
if (UIManager.INSTANCE.pin)
{
UIManager.INSTANCE.pin = false;
UIManager.INSTANCE.fill = true;
}
if (gameManager.dupPlug == (boltreferance))
{
gameManager.gamestate = GameManager.State.Select;
gameManager.dupPlug = null;
var parent = boltreferance.transform.parent;
parent.DOLocalMoveZ(parent.localPosition.z + boltremoveheight, 0.3f).SetEase(Ease.Linear).OnComplete(
() =>
{
gameManager.gamestate = GameManager.State.Done;
});
//gameManager.gamestate = GameManager.State.Select;
}
else if (gameManager.dupPlug!=(boltreferance))
{
gameManager.gamestate = GameManager.State.Select;
var parent = gameManager.dupPlug.transform.parent;
parent.DOLocalMoveZ(parent.localPosition.z + boltremoveheight, 0.3f).SetEase(Ease.Linear);
gameManager.dupPlug = null;
gameManager.dupPlug=boltreferance;
var parent1 = boltreferance.transform.parent;
//boltreferance.transform.GetComponent<Collider>().enabled = false;
parent1.DOLocalMoveZ(parent1.localPosition.z - boltremoveheight, 0.3f).SetEase(Ease.Linear).OnComplete(
() =>
{
gameManager.gamestate = GameManager.State.Done;
});
}
}
else if (gameManager.dupPlug == null)
{
gameManager.gamestate = GameManager.State.Select;
if (UIManager.INSTANCE.pin)
{
UIManager.INSTANCE.pin = false;
UIManager.INSTANCE.fill = true;
}
gameManager.vibration();
audioManager.Play("Bolt");
var parent = boltreferance.transform.parent;
parent.DOLocalMoveZ(parent.localPosition.z - boltremoveheight, 0.3f).SetEase(Ease.Linear).OnComplete(() =>
{
gameManager.gamestate = GameManager.State.Done;
});
gameManager.dupPlug = boltreferance;
}
}
// ReSharper disable Unity.PerformanceAnalysis
/*public void Boltshifting(GameObject boltreferance)
{
if (gameManager.selectedBolt.Count == 1)
{
gameManager.vibration();
audioManager.Play("Bolt");
if (UIManager.INSTANCE.pin)
{
UIManager.INSTANCE.pin = false;
UIManager.INSTANCE.fill = true;
}
if (gameManager.selectedBolt.Contains(boltreferance))
{
if (boltreferance.GetComponent<NewBolt>().connectedBodylist != null)
{
for (int i = 0; i < boltreferance.GetComponent<NewBolt>().connectedBodylist.Count; i++)
{
boltreferance.GetComponent<NewBolt>().connectedBodylist[i].GetComponentInParent<Rigidbody2D>().simulated = true;
}
}
gameManager.selectedBolt.RemoveAt(0);
var parent = boltreferance.transform.parent;
boltreferance.transform.GetComponent<Collider>().enabled = false;
parent.DOLocalMoveZ(parent.localPosition.z + boltremoveheight, 0.3f).OnComplete(() =>
{
boltreferance.transform.GetComponent<Collider>().enabled = true;
});
//gameManager.gamestate = GameManager.State.Select;
}
else if (!gameManager.selectedBolt.Contains(boltreferance))
{
gameManager.selectedBolt[0].transform.parent.DOLocalMoveZ(gameManager.selectedBolt[0].transform.parent.localPosition.z + boltremoveheight, 0.3f).SetEase(Ease.Linear);
gameManager.selectedBolt.RemoveAt(0);
/*if (boltreferance.GetComponent<NewBolt>().connectedBodylist != null)
{
for (int i = 0; i < boltreferance.GetComponent<NewBolt>().connectedBodylist.Count; i++)
{
boltreferance.GetComponent<NewBolt>().connectedBodylist[i].GetComponentInParent<Rigidbody2D>().simulated = true;
}
}#1#
gameManager.selectedBolt.Add(boltreferance);
var parent1 = boltreferance.transform.parent;
boltreferance.transform.GetComponent<Collider>().enabled = false;
parent1.DOLocalMoveZ(parent1.localPosition.z - boltremoveheight, 0.3f).SetEase(Ease.Linear).OnComplete(
() =>
{
boltreferance.transform.GetComponent<Collider>().enabled = true;
});
}
}
else if (gameManager.selectedBolt.Count==0)
{
/*if (boltreferance.GetComponent<NewBolt>().connectedBodylist != null)
{
for (int i = 0; i < boltreferance.GetComponent<NewBolt>().connectedBodylist.Count; i++)
{
boltreferance.GetComponent<NewBolt>().connectedBodylist[i].GetComponentInParent<Rigidbody2D>()
.simulated = false;
}
}#1#
if (UIManager.INSTANCE.pin)
{
UIManager.INSTANCE.pin = false;
UIManager.INSTANCE.fill = true;
}
gameManager.vibration();
audioManager.Play("Bolt");
boltreferance.transform.GetComponent<Collider>().enabled = false;
var parent = boltreferance.transform.parent;
audioManager.Play("Bolt");
parent.DOLocalMoveZ(parent.localPosition.z - boltremoveheight, 0.3f).OnComplete(() =>
{
boltreferance.transform.GetComponent<Collider>().enabled = true;
gameManager.gamestate = GameManager.State.Select;
});
gameManager.selectedBolt.Add((boltreferance));
//gameManager.dupPlug = boltreferance;
}
}*/
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a02196e077e1ce344831a7b867e89f67
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,292 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using TMPro;
using DG.Tweening;
using UnityEngine.UI;
public class UIManager : MonoBehaviour
{
public static UIManager INSTANCE;
public GameObject winpanel;
public GameObject nextbutton;
public GameObject retrybutton;
public TextMeshProUGUI level;
public List<int> helplevel;
[Header("LevelNumber Bar")] public Image lvlBgFill;
public GameObject[] lvlNumImgs;
public Sprite unFilled, filling;
public List<Sprite> specialImages;
public static int LvlNum = 0;
public static int levelAttempts;
public bool win;
[Header("Help Text")] [Header("unpin help")]
public GameObject PinObject;
public GameObject FillObject;
[Header("Key Help")] public GameObject KeyText;
public bool help;
public bool pin;
public bool fill;
public static int currentLvl = 0;
private void Awake()
{
INSTANCE = this;
LvlNum = PlayerPrefs.GetInt("levelnumber", 1);
//LvlNum = SceneManager.GetActiveScene().buildIndex;
LevelNumberHandler();
}
void Start()
{
if (helplevel.Contains(LvlNum))
{
if (PinObject != null && FillObject != null)
{
help = true;
}
if (PinObject != null && FillObject != null)
{
pin = true;
fill = false;
if (pin)
{
PinObject.SetActive(true);
}
}
}
if (KeyText != null)
{
KeyText.SetActive(true);
}
GAScript.LevelStart(PlayerPrefs.GetInt("levelnumber", 1), levelAttempts);
// level.text = "Level " + LvlNum.ToString();
//levelnum = currentLevel;
//AudioManager.instance.Play("BACKGROUND");
}
void Update()
{
/*if (levelnum == helplevel)
{
if (fill && !pin)
{
PinObject.SetActive(false);
FillObject.SetActive(true);
}
}*/
if (help)
{
if (fill && !pin)
{
PinObject.SetActive(false);
FillObject.SetActive(true);
}
}
if (help)
{
if (!fill && !pin)
{
PinObject.SetActive(false);
FillObject.SetActive(false);
}
}
}
private void LevelNumberHandler()
{
var lvlNumber = HandlingUnlockBasedOnLevel();
print(lvlNumber + ":;" + LvlNum);
lvlBgFill.DOFillAmount((lvlNumber - 1) / 5f, 0.25f).SetEase(Ease.Flash);
for (var i = 0; i < lvlNumImgs.Length - 1; i++)
{
if (i < lvlNumber - 1)
{
lvlNumImgs[i].GetComponent<Image>().color = Color.green;
}
else if (i == lvlNumber - 1) lvlNumImgs[i].GetComponent<Image>().sprite = filling;
}
switch (lvlNumber)
{
case 1:
lvlNumImgs[0].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = LvlNum.ToString();
lvlNumImgs[1].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum + 1).ToString();
lvlNumImgs[2].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum + 2).ToString();
lvlNumImgs[3].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum + 3).ToString();
BossLevelImg(true);
break;
case 2:
lvlNumImgs[0].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum - 1).ToString();
lvlNumImgs[1].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = LvlNum.ToString();
lvlNumImgs[2].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum + 1).ToString();
lvlNumImgs[3].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum + 2).ToString();
BossLevelImg(false);
break;
case 3:
lvlNumImgs[0].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum - 2).ToString();
lvlNumImgs[1].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum - 1).ToString();
lvlNumImgs[2].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = LvlNum.ToString();
lvlNumImgs[3].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum + 1).ToString();
BossLevelImg(false);
break;
case 4:
lvlNumImgs[0].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum - 3).ToString();
lvlNumImgs[1].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum - 2).ToString();
lvlNumImgs[2].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum - 1).ToString();
lvlNumImgs[3].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = LvlNum.ToString();
BossLevelImg(false);
break;
case 5:
lvlNumImgs[0].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum - 4).ToString();
lvlNumImgs[1].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum - 3).ToString();
lvlNumImgs[2].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum - 2).ToString();
lvlNumImgs[3].transform.GetChild(0).GetComponent<TextMeshProUGUI>().text = (LvlNum - 1).ToString();
BossLevelImg(false);
break;
}
}
private void BossLevelImg(bool call)
{
var lvlNo = PlayerPrefs.GetInt("SpecialImg", 0);
if (LvlNum > 5 && call && currentLvl != LvlNum)
{
lvlNo = lvlNo >= specialImages.Count - 1 ? specialImages.Count - 1 : ++lvlNo;
currentLvl = LvlNum;
}
// lvlNumImgs[^1].GetComponent<Image>().sprite = specialImages[lvlNo];
PlayerPrefs.SetInt("SpecialImg", lvlNo);
print(lvlNo + "::");
}
private int HandlingUnlockBasedOnLevel()
{
var currentlvlnum = 0;
var temp = LvlNum;
if (temp.ToString().Length > 1)
{
if (temp.ToString().EndsWith("1") || temp.ToString().EndsWith("6"))
{
currentlvlnum = 1;
}
else if (temp.ToString().EndsWith("2") || temp.ToString().EndsWith("7"))
{
currentlvlnum = 2;
}
else if (temp.ToString().EndsWith("3") || temp.ToString().EndsWith("8"))
{
currentlvlnum = 3;
}
else if (temp.ToString().EndsWith("4") || temp.ToString().EndsWith("9"))
{
currentlvlnum = 4;
}
else if (temp.ToString().EndsWith("5") || temp.ToString().EndsWith("0"))
{
currentlvlnum = 5;
}
}
else
{
if (temp.ToString().StartsWith("1") || temp.ToString().StartsWith("6"))
{
currentlvlnum = 1;
}
else if (temp.ToString().StartsWith("2") || temp.ToString().StartsWith("7"))
{
currentlvlnum = 2;
}
else if (temp.ToString().StartsWith("3") || temp.ToString().StartsWith("8"))
{
currentlvlnum = 3;
}
else if (temp.ToString().StartsWith("4") || temp.ToString().StartsWith("9"))
{
currentlvlnum = 4;
}
else if (temp.ToString().StartsWith("5") || temp.ToString().StartsWith("0"))
{
currentlvlnum = 5;
}
}
return currentlvlnum;
}
public void NextlevelButton()
{
GAScript.LevelCompleted(PlayerPrefs.GetInt("levelnumber", 1), levelAttempts);
// if (ISManager.instance) ISManager.instance.ShowInterstitialAds();
AdManager._Instance.ShowInterstitial();
if (AudioManager.instance)
{
AudioManager.instance.Play("Fill");
GameManager.instance.vibration();
}
Debug.Log($"Level Attempts::{levelAttempts}");
levelAttempts = 0;
//NEXT BUTTON CALL
if (PlayerPrefs.GetInt("Level", 1) >= SceneManager.sceneCountInBuildSettings - 1)
{
SceneManager.LoadScene(Random.Range(0, SceneManager.sceneCountInBuildSettings - 1));
PlayerPrefs.SetInt("Level", (PlayerPrefs.GetInt("Level", 1) + 1));
}
else
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
PlayerPrefs.SetInt("Level", (PlayerPrefs.GetInt("Level", 1) + 1));
}
PlayerPrefs.SetInt("levelnumber", PlayerPrefs.GetInt("levelnumber", 1) + 1);
}
public void retryButton()
{
if (AudioManager.instance)
{
AudioManager.instance.Play("Fill");
GameManager.instance.vibration();
}
// AdManager._Instance.ShowInterstitial();
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
levelAttempts++;
Debug.Log($"Level Attempts::{levelAttempts}");
}
public void Winpanel()
{
// AdManager._Instance.ShowInterstitial();
StartCoroutine(winactive());
}
IEnumerator winactive()
{
yield return new WaitForSeconds(0.5f);
winpanel.SetActive(true);
//StartCoroutine(nextWait());
}
/*public void restrtbuttonsymbol()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}*/
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 50d9cfc2456a5844394a5bb399b605a2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,261 @@
using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using Dreamteck.Splines;
//using Unity.VisualScripting;
using UnityEngine;
public class Wednesday : MonoBehaviour
{
public static Wednesday instance;
public GameObject Hand;
public Transform HandPos;
public GameObject Player;
public GameObject thief;
public Transform thiefpos;
public Transform ThiefFinalPos;
private void Awake()
{
instance = this;
}
void Start()
{
}
void Update()
{
}
public void weddone()
{
var seq = DOTween.Sequence();
seq.Append(Hand.transform.parent.DORotate(new Vector3(0, 30f, 0f), 0.4f, RotateMode.WorldAxisAdd).SetEase(Ease.Linear));
seq.AppendCallback(() =>
{
Hand.GetComponent<Animator>().SetTrigger("Run");
seq.Append(Hand.transform.parent.DOMove(new Vector3(0, -1.2f, 0f), 1f).SetEase(Ease.Linear).OnComplete(
() =>
{
Hand.GetComponent<Animator>().SetTrigger("Punch");
DOVirtual.DelayedCall(1.5f, () =>
{
if (AudioManager.instance)
{
AudioManager.instance.Play("Punch");
}
});
seq.Append(Hand.transform.parent.DORotate(new Vector3(0, -30f, 0f), 0.1f, RotateMode.WorldAxisAdd)
.SetEase(Ease.Linear).OnComplete(() =>
{
seq.Append(Hand.transform.parent.DORotate(new Vector3(45f, -10f, 10f), 0.1f, RotateMode.WorldAxisAdd)
.SetEase(Ease.Linear));
}));
}));
});
seq.AppendInterval(2.4f);
seq.AppendCallback(() =>
{
//Hand.transform.parent.GetComponent<DOTweenAnimation>().DOPlay();
Hand.transform.parent.GetComponent<DOTweenVisualManager>().enabled = true;
thief.GetComponent<Animator>().SetTrigger("Backpunch");
DOVirtual.DelayedCall(0.4f, () =>
{
Hand.transform.parent.GetComponent<DOTweenVisualManager>().enabled = false;
DOVirtual.DelayedCall(2.5f,()=>
{
Hand.transform.parent.GetComponent<DOTweenVisualManager>().enabled = true;
if (AudioManager.instance)
{
AudioManager.instance.Play("Punch");
}
DOVirtual.DelayedCall(0.4f, () =>
{
Hand.transform.parent.GetComponent<DOTweenVisualManager>().enabled = false;
DOVirtual.DelayedCall(1f, () =>
{
Hand.transform.parent.GetComponent<DOTweenVisualManager>().enabled = true;
if (AudioManager.instance)
{
AudioManager.instance.Play("Punch");
}
});
});
});
});
});
seq.AppendInterval(5f);
seq.AppendCallback(() =>
{
Player.GetComponent<SplineFollower>().enabled = true;
Player.GetComponent<SplineFollower>().spline = GameManager.instance.playerspline;
Player.GetComponent<Animator>().SetTrigger("Run");
//Player.GetComponent<SplineFollower>().follow = true;
Hand.transform.parent.DORotate(new Vector3(82, 120, 240), 0.5f);
Hand.transform.parent
.DOScale(
new Vector3(Hand.transform.parent.localScale.x - 30f, Hand.transform.parent.localScale.y - 30f,
Hand.transform.parent.localScale.z - 30f), 0.2f).SetEase(Ease.Linear);
Hand.transform.parent.DOJump(ThiefFinalPos.position, 4f, 1, 0.3f).OnComplete(() =>
{
if (AudioManager.instance)
{
AudioManager.instance.Play("Punch");
}
});
DOVirtual.DelayedCall(0.4f, () =>
{
thief.GetComponent<Animator>().SetTrigger("Cpunch");
Hand.GetComponent<Animator>().SetTrigger("Finalpunch");
});
DOVirtual.DelayedCall(2.4f, () =>
{
Hand.transform.parent.DOJump(thief.transform.position, 4f, 1, 1f).SetEase(Ease.Linear);
Hand.GetComponent<Animator>().SetTrigger("Run");
thief.GetComponent<Animator>().SetTrigger("TRY");
});
DOVirtual.DelayedCall(2.2f,() =>
{
Hand.transform.parent.DORotate(new Vector3(11, -105, 100-110), 0.3f).SetEase(Ease.Linear).OnComplete(
() =>
{
DOVirtual.DelayedCall(0.5f, () =>
{
Hand.transform.parent.DOMove(Player.transform.position, 3f).SetEase(Ease.Linear).OnComplete(
() =>
{
if (!UIManager.INSTANCE.win)
{
GameManager.instance.winning();
}
});
thief.GetComponent<Animation>().enabled = false;
});
});
/*DOVirtual.DelayedCall(0.2f, (() =>
{
Hand.transform.parent.DOMove(Player.transform.position, 3f).SetEase(Ease.Linear);
}));*/
});
});
}
public bool _dead;
public void thiefJerk()
{
if (!_dead)
{
thief.GetComponent<Animator>().SetTrigger("Cpunch");
if (AudioManager.instance)
{
AudioManager.instance.Play("Punch");
}
}
else
{
thief.GetComponent<Animator>().SetTrigger("TRY");
}
}
public void dead()
{
thief.GetComponent<Animator>().SetTrigger("TRY");
}
/*public void weddone()
{
/*var seq = DOTween.Sequence();
seq.Append(Hand.transform.DOMove(new Vector3(0, -2.5f, 0), 2f).SetEase(Ease.Linear));
seq.AppendCallback(() =>
{
Hand.GetComponent<Animator>().SetTrigger("Run");
});
//seq.AppendInterval(0.1f);
seq.AppendCallback(() =>
{
Hand.GetComponent<DOTweenAnimation>().DOPlay();
});#1#
Hand.GetComponent<Animator>().SetTrigger("Run");
Hand.transform.DOMove(new Vector3(0, -2.5f, 0), 2f).SetEase(Ease.Linear).OnComplete(() =>
{
Hand.GetComponent<DOTweenAnimation>().DOPlay();
});
/*Hand.transform.DOMove(HandPos.position, 2f).SetEase(Ease.Linear).OnComplete(() =>
{
Hand.GetComponent<DOTweenAnimation>().DOPlay();
});#1#
}
public void thiefdown()
{
Hand.GetComponent<Animator>().SetTrigger("Punch");
//Hand.transform.DOMove(new Vector3(thiefpos.position.x,thiefpos.position.y+3f,thiefpos.position.z), 0.3f).SetEase(Ease.Linear);
thief.GetComponent<Animator>().SetTrigger("Backpunch");
DOVirtual.DelayedCall(2f, () =>
{
Hand.GetComponent<Animator>().SetTrigger("Punch2");
DOVirtual.DelayedCall(1f, () =>
{
Hand.GetComponent<Animator>().SetTrigger("Punch2");
Player.GetComponent<SplineFollower>().spline = GameManager.instance.playerspline;
Player.GetComponent<Animator>().SetTrigger("Run");
Player.GetComponent<SplineFollower>().enabled = true;
Player.GetComponent<SplineFollower>().follow = true;
DOVirtual.DelayedCall(2f,() =>
{
/*Hand.transform
.DOMove(
new Vector3(thief.transform.localPosition.x, thief.transform.localPosition.y + 1f,
thief.transform.localPosition.z), 1f).SetEase(Ease.Linear);
#1#
Hand.transform
.DOScale(
new Vector3(Hand.transform.localScale.x - 25f, Hand.transform.localScale.y - 25f,
Hand.transform.localScale.z - 25f), 0.5f).SetEase(Ease.Linear);
Hand.transform.DORotate(new Vector3(75, -95, 60), 0.5f).SetEase(Ease.Linear);
Hand.transform.DOJump(new Vector3(ThiefFinalPos.transform.localPosition.x,
ThiefFinalPos.transform.localPosition.y ,
ThiefFinalPos.transform.localPosition.z), 5f, 1, .25f).SetEase(Ease.Linear).OnComplete(() =>
{
thief.GetComponent<Animator>().SetTrigger("Cpunch");
Hand.GetComponent<Animator>().SetTrigger("Finalpunch");
DOVirtual.DelayedCall(2.2f, () =>
{
_dead = true;
Hand.transform.DORotate(new Vector3(-5f, -95f, 10f), 0.5f).SetEase(Ease.Linear);
Hand.GetComponent<Animator>().SetTrigger("LastPunch");
Hand.transform.DOJump(thief.transform.position, 3, 1, .5f).SetEase(Ease.Linear).OnComplete(
() =>
{
Hand.transform.DOMove(Player.transform.position, 5f).SetEase(Ease.Linear);
});
Hand.GetComponent<Animator>().SetTrigger("Run");
});
});
});
});
});
}*/
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 59bb4fe35b0496f4cb9c73ab34aced25
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class maskcheck : MonoBehaviour
{
//public CircleCollider2D boltcoll;
// Start is called before the first frame update
void Start()
{
//boltcoll = GetComponent<CircleCollider2D>();
}
void Update()
{
}
private void OnTriggerStay(Collider other)
{
if (other.gameObject.CompareTag("MASk"))
{
gameObject.tag = "Fill";
}
}
private void OnTriggerExit(Collider other)
{
if (other.gameObject.CompareTag("MASk"))
{
gameObject.tag = "Untagged";
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f7a6fed8f59173a4982d659c8d3a3a4b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class menu : MonoBehaviour
{
private void Start()
{
//Vibration.Init();
SceneManager.LoadScene(PlayerPrefs.GetInt("levelnumber", 1) > SceneManager.sceneCountInBuildSettings - 1
? Random.Range(1, SceneManager.sceneCountInBuildSettings - 1)
: PlayerPrefs.GetInt("levelnumber", 1));
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 328fac9d436a03241885424e15919852
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: