public GameAction GetNextMove(Character controlledChar, bool preThink, ReRandom rand) { foreach (BasePlan plan in Plans) { GameAction result = AttemptPlan(controlledChar, plan, preThink, rand); if (result != null) { return(result); } } currentPlan = null; return(new GameAction(GameAction.ActionType.Wait, Dir8.None)); }
protected GameAction AttemptPlan(Character controlledChar, BasePlan plan, bool preThink, ReRandom rand) { if ((currentPlan != null) && (currentPlan.GetType() == plan.GetType())) { return(currentPlan.Think(controlledChar, preThink, rand)); } else { plan.SwitchedIn(); GameAction result = plan.Think(controlledChar, preThink, rand); if (result != null) { currentPlan = plan; } return(result); } }