Example #1
0
        public void SetState(Enum stateToActivate, ITTStateMachine useGameStateMachine)
        {
            if (state.executingStateMachine == useGameStateMachine && stateToActivate == state.currentState)
            {
                return;
            }

            if (_exitedState && _enteredState)
            {
                _exitedState  = false;
                _enteredState = false;
            }
            else
            {
                return;
            }

            ChangingState();
            state.currentState          = stateToActivate;
            state.executingStateMachine = useGameStateMachine;

            if (useGameStateMachine != this)
            {
                useGameStateMachine.baseStateMachine = this;
            }

            state.executingStateMachine.state.currentState = stateToActivate;
            useGameStateMachine.Represent(gameObject);
            ConfigureCurrentState();
        }
Example #2
0
 protected virtual void OnAwake()
 {
     state.executingStateMachine = baseStateMachine = this;
     _exitedState   = true;
     _enteredState  = true;
     localTransform = base.transform;
     Represent(base.gameObject);
 }
Example #3
0
 void ChangingState()
 {
     lastState = state.currentState;
     lastGameStateMachineBehavior = state.executingStateMachine;
     _timeEnteredState            = Time.time;
 }