public IBehaviorState StateFactory(States state) { IBehaviorState ret = null; switch (state) { case States.Idling: break; case States.Roaming: ret = new RoamingState(host) as IBehaviorState; break; case States.Pursuing: ret = new PursuingState(host) as IBehaviorState; break; case States.Fighting: ret = new FightingState(host) as IBehaviorState; break; case States.Ranged: ret = new RangedCombatState(host) as IBehaviorState; break; case States.Melee: ret = new MeleeCombatState(host) as IBehaviorState; break; } if (ret != null) { ret.Init(this); } return(ret); }
private void ChangeState(IBehaviorState newState) { currentState = newState; StateStart(); }
public void ChangeState(States state) { GD.Print("Changing state to " + state); activeState = StateFactory(state); }