ExitState() public method

public ExitState ( Enums, p_nextState ) : void
p_nextState Enums,
return void
コード例 #1
0
    void Update()
    {
        // State machine shenanigans
        if (!m_initialised)
        {
            return;
        }

        if (m_currentGameState != null)
        {
            m_currentGameState.UpdateState();
        }

        if (m_nextGameStateIndex != Enums.GameStateNames.GS_00_NULL)
        {
            if (m_currentGameState != null)
            {
                m_currentGameState.ExitState(m_nextGameStateIndex);
            }
            m_currentGameState = m_gameStateDictionary[m_nextGameStateIndex];
            m_currentGameState.EnterState(m_currentGameStateIndex);
            m_currentGameStateIndex = m_nextGameStateIndex;
            m_nextGameStateIndex    = Enums.GameStateNames.GS_00_NULL;
        }
    }
コード例 #2
0
    public void SwitchState(EGameStateType stateType)
    {
        if (m_curState != null)
        {
            m_curState.PreExitState();
            m_curState.ExitState();
        }

        m_stateDic.TryGetValue((int)stateType, out m_curState);
        if (m_curState != null && m_curState.StateType == stateType)
        {
            m_curState.PreEnterState();
            m_curState.EnterState();
        }
    }
コード例 #3
0
 /// <summary>
 /// Exits current state.
 /// </summary>
 public void ExitCurrentState()
 {
     currentGameState.ExitState();
 }
コード例 #4
0
 /// <summary>
 /// Exits current state.
 /// </summary>
 public void ExitCurrentState()
 {
     currentGameState.ExitState();
     // Debug.Log("Saiu do state");
 }