/// <summary> /// Updates the state before the game is played. /// Updates the countdown timer and fade in animation. /// </summary> void UpdateStarting() { _transitionPanel.ManualUpdate(); if (!_transitionPanel.playingAnimation) { //if the transition has finished playing if (_startingTime > 0) { //and countdown is still going _startingTime -= Time.deltaTime; if (_startingTime < 0) {//if coundown finished _startingTime = 0; _countDownText.gameObject.SetActive(false); } _countDownText.text = "" + (int)_startingTime; } else {//change the state to playing _gameState = GameState.Playing; } //update input. CheckForInput(); } }
/// <summary> /// Updates the class /// </summary> void Update() { _transitionPanel.ManualUpdate(); if (_checkForTransition) { //if scene is being changed if (!_transitionPanel.playingAnimation) { //check if transition finished to switch the scene SceneLoader.LoadTargetScene(); } } }