Esempio n. 1
0
 /// <summary>
 /// Pauses the current state. PauseState will become active.
 /// </summary>
 public void PauseCurrentState()
 {
     if (PauseState != null)
     {
         PauseState.EnterState();
     }
     CurrentState.Pause();
 }
    public void SwitchState()
    {
        GameObject.FindGameObjectWithTag("Player").GetComponent <WeaponScript>().AddAmmo();

        if (currentState == gameplayState)
        {
            gameplayState.ExitState();
            pauseState.EnterState();
            currentState = pauseState;
        }
        else if (currentState == pauseState)
        {
            pauseState.ExitState();
            gameplayState.EnterState();
            currentState = gameplayState;
        }
    }