Пример #1
0
    /// <summary>
    /// Method om de state te wijzigen
    /// </summary>
    public void SetState(StateID stateID)
    {
        /** als we de stateID niet kennen als state: stop deze functie dan */
        if (!states.ContainsKey(stateID))
        {
            return;
        }

        /** als we ons al in een state bevinden: geef de state de mogelijkheid zich op te ruimen */
        if (currentState != null)
        {
            currentState.Leave();
        }

        /** we stellen de nieuwe currentState in */
        currentState = states[stateID];
        currIdInt    = (int)stateID;
        /** we stellen de nieuwe currentState in */
        currentState = states[stateID];
        /** we geven de nieuwe state de mogelijkheid om zich zelf in te stellen */
        currentState.Enter();
    }