public void ChangeState(IMinionState newState) { currentState?.Exit(); currentState = newState; currentState.Enter(owner); //If we get a new state given to us we should drop what we are doing and enter the new state if (owner.CurrentJob != null && newState.Status == MinionStatus.Reproducing) { owner.CurrentJob.CancelJob(); } }
public StateMachine(Minion owner, IMinionState startingState) { this.owner = owner; ChangeState(startingState); }