private void CheckDepth() { float v = PlayerPrefHelper.LoadFloat(PlayerPrefHelper.FURTHEST_DEPTH); float highest = v > this.Depth ? v : this.Depth; PlayerPrefHelper.SaveFloat(PlayerPrefHelper.FURTHEST_DEPTH, (int)highest); SetFurthestTextBoard((int)highest); }
public void OnOxygenUpgradeButton() { var pearlCount = PlayerPrefHelper.LoadInt(PlayerPrefHelper.PEARL_COUNT); this.PearlCount = pearlCount - 2; PlayerPrefHelper.SaveInt(PlayerPrefHelper.PEARL_COUNT, this.PearlCount); this.OxygenAmount = PlayerPrefHelper.LoadFloat(PlayerPrefHelper.OXYGEN_AMOUNT, 30); PlayerPrefHelper.SaveFloat(PlayerPrefHelper.OXYGEN_AMOUNT, this.OxygenAmount + 30); uiAnimator.UpdateMainText(); }
private void SwitchState(GameState state) { if (state == this.GameState) { return; } this.GameState = state; switch (state) { case GameState.None: break; case GameState.Shop: instructionUI.ResetInstructions(); ropeAnimator.ResetRope(); lightActivator.ResetLight(); radarAlertActivator.ResetAlert(); trackCreator.ResetTrackCreator(); playerSub.position = spawnPoint.position; playerSub.rotation = Quaternion.Euler(0, 0, 0); playerSub.GetComponent <BubbleSpawner>().enabled = false; playerSub.GetComponent <PlayerController>().enabled = false; followerComponent.transform.position = Vector3.zero; followerComponent.enabled = false; this.Depth = 0; this.UIFadedIn = false; this.CanTakeOxygen = false; uiAnimator.RunAnimationIn(); break; case GameState.Transition: uiAnimator.RunAnimationOut(); ropeAnimator.RunRopeAnimation(); break; case GameState.Game: this.OxygenAmount = PlayerPrefHelper.LoadFloat(PlayerPrefHelper.OXYGEN_AMOUNT, 30); this.CurrentOxygen = this.OxygenAmount; AudioManager.Instance.StopSFX(SFXList.Crank); AudioManager.Instance.PlaySFX(SFXList.Fan); playerSub.GetComponent <BubbleSpawner>().enabled = true; playerSub.GetComponent <PlayerController>().enabled = true; playerSub.GetComponent <PlayerController>().OnDeath = () => { AudioManager.Instance.PlaySFX(SFXList.DieCrash); SwitchState(GameState.Dead); }; followerComponent.enabled = true; ropeAnimator.RunRopePullUpAnimation(); bool isInstructions = PlayerPrefHelper.LoadBool(PlayerPrefHelper.HAS_PLAYED_BEFORE); if (!isInstructions) { instructionUI.RunAnimationIn(); } break; case GameState.Dead: AudioManager.Instance.StopSFX(SFXList.Crank); AudioManager.Instance.StopSFX(SFXList.Fan); CheckDepth(); SwitchState(GameState.Shop); uiAnimator.RunGameUIAnimationOut(); break; } }
public void Start() { this.PearlCount = PlayerPrefHelper.LoadInt(PlayerPrefHelper.PEARL_COUNT); this.OxygenAmount = PlayerPrefHelper.LoadFloat(PlayerPrefHelper.OXYGEN_AMOUNT, 30); CheckDepth(); }