Esempio n. 1
0
    public bool ChangeState(S NextState, params object[] args)
    {
        if (NextState.CompareTo(UnassignedType) == 0)
        {
            return(false);
        }
        if (_changingState)
        {
            return(false);
        }
        if (_currentStateTag.CompareTo(NextState) == 0)
        {
            return(false);
        }
        if (!_states.TryGetValue(NextState, out Deus_State newState))
        {
            return(false);
        }
        _changingState = true;
        Deus_State currentState = CurrentState;

        if (currentState != null)
        {
            currentState.OnStateExit(NextState, args);
        }
        newState.OnStateEnter(_currentStateTag, args);
        _currentStateTag = NextState;
        _changingState   = false;
        return(true);
    }
Esempio n. 2
0
 public void RegisterState(Deus_State state)
 {
     _states[state.StateType] = state;
 }