Example #1
0
    /// <summary>
    /// 状態の変更を行う
    /// </summary>
    public void ChangeCall(StateEnum targetState)
    {
        if (!isInitialize)
        {
            Debug.LogWarning("まだStateControllerの初期化がされていません");
        }

        if (!isContainsState(targetState))
        {
            Debug.LogWarning("該当ステートが設定されていません:" + targetState.ToString());
        }

        beforeState  = currentState;
        currentState = targetState;

        step = StateStepEnum.End;
        if (stepActionList[beforeState][(int)StateStepEnum.End] != null)
        {
            stepActionList[beforeState][(int)StateStepEnum.End].Invoke();
        }

        step = StateStepEnum.Start;
        if (stepActionList[currentState][(int)StateStepEnum.Start] != null)
        {
            stepActionList[currentState][(int)StateStepEnum.Start].Invoke();
        }
    }
Example #2
0
 /// <summary>
 /// 現在の状態で継続的な呼び出しを行う
 /// </summary>
 public void UpdateCall()
 {
     step = StateStepEnum.Update;
     if (stepActionList[currentState][(int)StateStepEnum.Update] != null)
     {
         stepActionList[currentState][(int)StateStepEnum.Update].Invoke();
     }
 }