protected override void OnStateEntered(IAIStateMachine machine, IAIState lastState) { if (_defaultState is IAIState) { _stateMachine.ChangeState(_defaultState as IAIState); } }
protected override void OnStateExited(IAIStateMachine machine, IAIState nextState) { if (_stateMachine.Current != null) { _stateMachine.ChangeState((IAIState)null); } }
public AIStateMachine(IAIStateMachine owner) { _owner = owner ?? this; }
public AIStateMachine() { _owner = this; }
void IAIState.OnStateEntered(IAIStateMachine machine, IAIState lastState) { _isActive = true; this.OnStateEntered(machine, lastState); _onEnterState.ActivateTrigger(this, null); }
void IAIState.OnStateExited(IAIStateMachine machine, IAIState nextState) { this.OnStateExited(machine, nextState); _isActive = false; _onExitState.ActivateTrigger(this, null); }
protected abstract void OnStateExited(IAIStateMachine machine, IAIState nextState);
void IAIState.Init(IAIStateMachine machine) { this.StateMachine = machine; }
protected virtual void OnInit(IAIStateMachine machine) { }
protected abstract void OnStateEntered(IAIStateMachine machine, IAIState lastState);
void IAIState.Init(IAIStateMachine machine) { this.StateMachine = machine; this.OnInit(machine); }
void IAIState.OnStateExited(IAIStateMachine machine, IAIState nextState) { this.OnStateExited(machine, nextState); _isActive = false; }
void IAIState.OnStateExited(IAIStateMachine machine, IAIState nextState) { _loop.Reset(); this.OnStateExited(machine, nextState); _isActive = false; }
protected virtual void OnStateExited(IAIStateMachine machine, IAIState nextState) { }
protected virtual void OnStateEntered(IAIStateMachine machine, IAIState lastState) { }