public void TogglePause() { if (!ClimberStateManager.isPaused) { ClimberStateManager.SwitchState(ClimberState.PAUSE); if (smallButton) { smallButton.Hide(); } if (pauseBG) { pauseBG.SetActive(true); } } else { ClimberStateManager.SwitchState(); if (pauseBG) { pauseBG.SetActive(false); } } BankController[] banks = FindObjectsOfType <BankController>(); foreach (var item in banks) { item.Refresh(); } }
public void Fly(int n) { if (ClimberStateManager.state != ClimberState.IDLE) { timer = 0; camCtrl.IncProgress(direction); RemoveQueue(); //queue.RemoveAt (0); jumpCount += direction; adjustFlight = true; ClimberStateManager.SwitchState(ClimberState.JUMPING); LeanTween.value(gameObject, UpdateShit, 0, 1, 0.5f).setEase(moveAnimation).setOnComplete(Fly); } else { Fly(); } LeanTween.delayedCall(character.rocket, 0.1f, () => { character.rocket.SetActive(true); }); character.ToggleChar(false); for (int i = 0; i < n; i++) { successCount++; AddQueue(1); } }
public void Fall(Action callback) { ClimberStateManager.SwitchState(ClimberState.FALLING); hasPicked = false; anim.Fall(); height = -Mathf.Abs(height); onEnd = callback; }
void Update() { if (destroy && !particles[0].isPaused) { timer -= Time.deltaTime; if (timer < 0) { ClimberStateManager.Unsubscribe(this); Destroy(gameObject); } } }
void EndFlight() { Debug.Log("FlightEnd!"); if (ClimberStateManager.state != ClimberState.LEVELUP) { ClimberStateManager.SwitchState(ClimberState.IDLE); } character.rocket.SetActive(false); character.ToggleChar(true); }
public void Init(Vector3 pos) { // if (shb != null) { // shb.Deactivate (); // FindObjectOfType<HelpController> ().root.SetActive (false); // } if (initSound != null) { LeanAudio.play(initSound); } Overlay.instance.Purge(); ClimberStateManager.SwitchState(ClimberState.LEVELUP); theStar.SetActive(true); theStar.transform.position = pos; theStar.transform.localScale = Vector3.one * 0.08f; theShadow.SetActive(true); theShadow.transform.localScale = Vector3.one * 0.08f; theShadow.transform.localPosition = new Vector3(pos.x, screenCenter.y - 1.9f, pos.z); theYellowThing.SetActive(true); theYellowThing.transform.position = pos; theYellowThing.transform.localScale = Vector3.one * 0.3f; LeanTween.scale(theYellowThing, Vector3.one * 10, 0.3f); //Star animation LeanTween.moveLocalY(theStar, screenCenter.y + 2f, appearTime / 2).setEase(LeanTweenType.easeOutSine).setOnComplete(() => { LeanTween.moveLocalY(theStar, screenCenter.y, appearTime / 2).setEase(LeanTweenType.easeInSine); }); LeanTween.moveLocalX(theStar, screenCenter.x, appearTime).setEase(LeanTweenType.easeInCubic); LeanTween.moveLocalX(theShadow, screenCenter.x, appearTime).setEase(LeanTweenType.easeInCubic); LeanTween.scale(theStar, Vector3.one * 0.5f, appearTime); LeanTween.scale(theShadow, Vector3.one * 0.5f, appearTime).setEase(LeanTweenType.easeInCubic); LeanTween.delayedCall(appearTime + 0.1f, () => { inPlace = true; textObj.SetActive(true); LeanTween.alpha(theShadow, 0.3f, 1f).setLoopPingPong().setEase(LeanTweenType.easeInOutSine); LeanTween.moveLocalY(theStar, screenCenter.y + 0.7f, 1f).setEase(LeanTweenType.pingPong).setLoopPingPong().setEase(LeanTweenType.easeInOutSine); GameObject particle = Instantiate(landingPoof, theStar.transform.position + Vector3.up * -1.6f, burstPoof.transform.rotation); particle.transform.localScale = Vector3.one * 1.5f; //particle.transform.position = transform.position; Destroy(particle, 1f); }); bank.MoveToCenter(); ui.xpRoot.SetActive(false); SetLevel(); FindObjectOfType <BombController>().explosion.gameObject.SetActive(false); }
void Fly() { if (adjustFlight) { adjustFlight = false; stairCtrl.SnapBack(); } ClimberStateManager.SwitchState(ClimberState.FLYING); timer = _slideTime; direction = 1; }
// Use this for initialization void Start() { particles = GetComponentsInChildren <ParticleSystem> (); ClimberStateManager.Subscribe(this); for (int i = 0; i < particles.Length; i++) { if (!particles[i].main.loop && particles[i].main.duration > timer) { timer = particles [i].main.duration; } } }
public void MainMenu() { ClimberStateManager.SwitchState(ClimberState.RELOADING); ui.Unpause(); if (FLS_LoadingScreen.instance) { FLS_LoadingScreen.instance.loadScene("Menu01"); } else { Debug.LogWarning("No Loading Screen instance available."); SceneManager.LoadScene("Menu01"); } }
public ClimberStateManager() { if (_instance == null) { _instance = this; } else if (_instance != this) { //_instance = this; Debug.LogWarning("There already is one State Manager"); return; } pauseListeners = new List <IPauseHandler> (); _curState = new IdleState(); }
void Awake() { Application.targetFrameRate = 30; Dependencies dep = new Dependencies(); dep.main = this; dep.normalBank = null; dep.shopBank = null; dep.levelUpScreen = FindObjectOfType <LevelUpScreen> (); dep.ui = FindObjectOfType <TaskUI> (); ClimberStateManager state = new ClimberStateManager(); ClimberStateManager.Init(dep); ClimberStateManager.SwitchState(ClimberState.IDLE); }
public void Jump(Action callback) { ClimberStateManager.SwitchState(ClimberState.JUMPING); hasPicked = false; anim.Jump(); height = Mathf.Abs(height); onEnd = callback; if (isTemp) { tempJumps++; if (tempJumps > 5) { isTemp = false; SpawnChar(Persistence.currentChar); } } }
// Use this for initialization void Start() { dropMgr = FindObjectOfType <DropManager> (); charStorage = FindObjectOfType <CharacterStorage> (); SpawnChar(Persistence.currentChar); //Init (); charOrigin = gameObject.transform.position; charOrigin.y += 1.25f; ClimberStateManager.Subscribe(this); stepUp = charOrigin + Vector3.forward * 1.6f /*725f*/ + Vector3.down * 0.765f; stepUp.y += 1.25f; stepDown = charOrigin + Vector3.back * 1.6f /*725f*/ + Vector3.up * 0.765f; stepDown.y -= 1.0f; rocket.SetActive(false); }
public void Open() { //DeselectAll (); if (!shopAnim.GetBool("IsOpen") && !isOpening) { isOpening = true; ClimberStateManager.SwitchState(ClimberState.SHOP); SelectCurrent(false); bank.Refresh(); panel.SetActive(true); curtainAnim.gameObject.SetActive(true); shopAnim.SetBool("IsOpen", true); curtainAnim.SetBool("IsOpen", true); //LeanTween.cancel (bank.gameObject); bank.StopAnimations(); bank.GetComponent <RectTransform> ().anchoredPosition = new Vector2(0, 158); bank.DisableButton(); } }
void Loop() { if (queue.Count > 0) { if (queue [0] > 0) { direction = 1; character.Jump(OnJumpEnd); } else { direction = -1; character.Fall(OnJumpEnd); } } else { ClimberStateManager.SwitchState(ClimberState.IDLE); } }
void OnJumpEnd(Spine.TrackEntry trc) { if (trc.Animation.name == "tap") { trc.mixDuration = 0; anim.resetIdle(); } else if (trc.Animation.name != "idle") { trc.mixDuration = 0; adjustHeight = true; anim.resetIdle(); onEnd(); } else if (trc.Animation.name == "idle") { if (ClimberStateManager._instance._curState.state != ClimberState.IDLE) { ClimberStateManager.SwitchState(ClimberState.IDLE); } } }
public void forceIdle() { ClimberStateManager.SwitchState(ClimberState.IDLE); anim.resetIdle(); }
void OnJumpEnd() { ClimberStateManager.SwitchState(ClimberState.MOVING); timer = _slideTime; }