Exemplo n.º 1
0
    public void ChangeState(T state)
    {
        if (_StateDictionary.ContainsKey(state) == false)
        {
            Debug.LogError("キーが含まれていません。" + state.ToString());
            return;
        }

        T prevState = default(T);

        if (_CurrentState != null)
        {
            prevState = _CurrentState.Key;
            _CurrentState.Exit(state);
        }

        _CurrentState = _StateDictionary[state];
        _CurrentState.Enter(prevState);
    }