// Update is called once per frame void FixedUpdate() { switch (_state) { case GameState.MainMenu: if (_prevState != _state) { GUI_mainMenu.gameObject.SetActive(true); GUI_inGame.gameObject.SetActive(false); } break; case GameState.Reset: _playerInstance.Reset(); inputManager.Reset(); _camera.Reset(); lava.Reset(); _state = GameState.Start; break; case GameState.Start: _state = GameState.Game; _adsManager.HideAd(); levelGenerator.SetState(LevelGenerator.GeneratorState.START); _playerInstance.SetState(PlayerPrototype.PlayerState.Falling); break; case GameState.Game: if (_playerInstance.state == PlayerPrototype.PlayerState.Dead) { levelGenerator.SetState(LevelGenerator.GeneratorState.DEAD); } if ((int)_playerInstance.transform.position.y > _maxPlayerPositionY) { _maxPlayerPositionY = (int)_playerInstance.transform.position.y; _gameServiceManager.SetScore(_maxPlayerPositionY); GUI_scoreBoard.text = "" + _maxPlayerPositionY; } inputManager.HandleInput(); if (inputManager.performDoubleJump) { inputManager.performDoubleJump = false; _playerInstance.DoubleJump(); } break; case GameState.Killed: //TODO menu blabla if (_prevState != _state) { levelGenerator.SetState(LevelGenerator.GeneratorState.RESET); _collectibleManager.SetState(CollectibleManager.ManagerState.RESET); GUI_mainMenu.gameObject.SetActive(true); GUI_inGame.gameObject.SetActive(false); _adsManager.ShowAd(); } //_state = GameState.Reset; break; } _prevState = _state; }