예제 #1
0
        // Use this for initialization
        public override void IntializeController()
        {
            base.IntializeController();

            _timeCounter = new Stopwatch();
            _timeLimit   = new TimeSpan(0, _startMinutesLeft, _startSecondsLeft);

            GameScore.AddEnergy(_startEnergy);
            GameScore.AddOxygen(_startOxygen);

            CreateMap();
            CreatePlayer();
        }
예제 #2
0
        private void UpdateOxygen()
        {
            if (_player.IsImmerse)
            {
                if (GameScore.CurrentOxygen > 0)
                {
                    GameScore.AddOxygen(-_oxygenGainSpeed * Time.deltaTime);

                    if (GameScore.CurrentOxygen <= 0)
                    {
                        Pause();
                        _player.UI.EnableGameOverPanel(UI.GameOverType.Lost);
                    }
                }
            }
            else
            {
                if (GameScore.CurrentOxygen < 1)
                {
                    GameScore.AddOxygen((_oxygenGainSpeed / 4f) * Time.deltaTime);
                }
            }
        }