Beispiel #1
0
    protected void ChangeState(SSM_State action)
    {
        if (action == null || action == CurrentState)
        {
            return;
        }

        CurrentState?.OnExit();
        CurrentState = action;
        CurrentState?.OnEnter();
        canRunOnLateEnter = true;
    }
Beispiel #2
0
    protected virtual void OnEnable()
    {
        // Run Action Logic
        if (CurrentState != null)
        {
            if (logics_Event.ContainsKey(When.OnEnable))
            {
                ChangeState(logics_Event[When.OnEnable]());
            }

            CurrentState.OnEnter();
        }

        // Set Current Action to Default Action
        if (CurrentState == null)
        {
            CurrentState = DefaultState;
        }
    }
Beispiel #3
0
 protected void SetDefaultState(SSM_State defaultState)
 {
     DefaultState = defaultState;
 }