Beispiel #1
0
        public void Update()
        {
            bool hasRadarUpgrade = PlayerPrefHelper.LoadBool(PlayerPrefHelper.UPGRADE_RADAR);
            var  list            = GameManager.Instance.Monsters.OrderBy(x => Vector3.Distance(x.transform.position, transform.position)).ToList();

            if (list.Any())
            {
                if (hasRadarUpgrade && Vector3.Distance(transform.position, list[0].transform.position) <= 9 && transform.position.y > list[0].transform.position.y)
                {
                    alert.SetActive(true);
                    if (!this.IsPlayingAudio)
                    {
                        this.IsPlayingAudio = true;
                        AudioManager.Instance.PlaySFX(SFXList.Radar);
                    }
                }
                else
                {
                    ResetAlert();
                }
            }
            else
            {
                ResetAlert();
            }
        }
Beispiel #2
0
        private void CheckInstructions()
        {
            bool isInstructions = PlayerPrefHelper.LoadBool(PlayerPrefHelper.HAS_PLAYED_BEFORE);

            if (!isInstructions && playerSub.GetComponent <PlayerController>().Vertical < 0)
            {
                instructionUI.RunAnimationOut();
                PlayerPrefHelper.SaveBool(PlayerPrefHelper.HAS_PLAYED_BEFORE, 1);
            }
        }
Beispiel #3
0
        public void Update()
        {
            bool hasLightUpgrade = PlayerPrefHelper.LoadBool(PlayerPrefHelper.UPGRADE_LIGHT);

            if (!this.IsActivated && hasLightUpgrade && transform.position.y <= lightActivatorPosition.position.y)
            {
                AudioManager.Instance.PlaySFX(SFXList.LightClick);
                this.IsActivated = true;
                light.SetActive(true);
            }
        }
Beispiel #4
0
        public void UpdateMainText()
        {
            int  count           = GameManager.Instance.PearlCount;
            bool hasLightUpgrade = PlayerPrefHelper.LoadBool(PlayerPrefHelper.UPGRADE_LIGHT);
            bool hasRadarUpgrade = PlayerPrefHelper.LoadBool(PlayerPrefHelper.UPGRADE_RADAR);

            mainText.text = $"You have <color=#17224B>{count}</color> Pearl{(count != 1 ? "s":"")} to spend";

            //Handle locking and of grabbed UI
            oxygenButton.interactable = !(count < 2);
            oxygenLockImage.gameObject.SetActive(count < 2);

            lightButton.interactable = !(count < 6) && !hasLightUpgrade;
            lightLockImage.gameObject.SetActive(count < 6 || hasLightUpgrade);

            radarButton.interactable = !(count < 10) && !hasRadarUpgrade;
            radarLockImage.gameObject.SetActive(count < 10 || hasRadarUpgrade);
        }
Beispiel #5
0
        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;
            }
        }