Beispiel #1
0
 private void Awake()
 {
     IdleState  = new PlayerIdleState(this);
     RunState   = new PlayerRunState(this);
     FightState = new PlayerFightState(this);
     WinState   = new PlayerWinState(this);
     LoseState  = new PlayerLoseState(this);
 }
Beispiel #2
0
        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;
        }
Beispiel #3
0
 /// <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);
 }
Beispiel #4
0
        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;
        }
Beispiel #5
0
 /// <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);
 }