private void Awake() { IdleState = new PlayerIdleState(this); RunState = new PlayerRunState(this); FightState = new PlayerFightState(this); WinState = new PlayerWinState(this); LoseState = new PlayerLoseState(this); }
void RaisePlayerLossEvent(PlayerLoseState a_state) { CancelInvoke(); // Ignore attempts to raise player events, when a state has been already determined if (_winState != WinState.None) { Debug.LogWarning("Attempted to raise PlayerLoss Event, but player win state has already been determined, ignoring..."); return; } // Notify listeners of event foreach (GameObject eventListener in _eventListeners) { ExecuteEvents.Execute <ISceneManagerEvents>(eventListener, null, (x, y) => x.OnPlayerFailed(a_state)); } // Set win state to current event _winState = WinState.Loss; }
/// <summary> /// Called when player has either ran out of explosion triggers /// or detonated a nuclear sheep /// </summary> public void OnPlayerFailed(PlayerLoseState a_state) { // Show loss prompt, and hide pause button _lossMenu.SetActive(true); _pauseButton.SetActive(false); }
void RaisePlayerLossEvent(PlayerLoseState a_state) { CancelInvoke(); // Ignore attempts to raise player events, when a state has been already determined if (_winState != WinState.None) { Debug.LogWarning("Attempted to raise PlayerLoss Event, but player win state has already been determined, ignoring..."); return; } // Notify listeners of event foreach (GameObject eventListener in _eventListeners) { ExecuteEvents.Execute<ISceneManagerEvents>(eventListener, null, (x, y) => x.OnPlayerFailed(a_state)); } // Set win state to current event _winState = WinState.Loss; }
/// <summary> /// Called when player has either ran out of explosion triggers /// or detonated a nuclear sheep /// </summary> public void OnPlayerFailed(PlayerLoseState a_state) { // Show loss prompt, and hide pause button _lossMenu.SetActive(true); _pauseButton.SetActive(false); }