Beispiel #1
0
    public void AddState(Enum p_enum, Script_IState p_state)
    {
        int key = Convert.ToInt32(p_enum);

        if (!_states.ContainsKey(key))
        {
            _states.Add(key, p_state);
        }
    }
Beispiel #2
0
    public void SetState(Enum p_enum)
    {
        int key = Convert.ToInt32(p_enum);

        if (_states [key] != _currentState)
        {
            if (_states.ContainsKey(key))
            {
                if (_currentState != null)
                {
                    _currentState.Exit();
                }
                _currentState = _states [key];
                _currentState.Enter();
            }
        }
    }
Beispiel #3
0
 public Script_Statemachine()
 {
     _currentState = null;
     _states       = new Dictionary <int, Script_IState> ();
 }