protected void ChangeState(SSM_State action) { if (action == null || action == CurrentState) { return; } CurrentState?.OnExit(); CurrentState = action; CurrentState?.OnEnter(); canRunOnLateEnter = true; }
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; } }
protected void SetDefaultState(SSM_State defaultState) { DefaultState = defaultState; }