public static void GiveOrderToUnits(OrderableObject[] orderableObjects, GameOrderInitParams gameOrderInitParams, GameOrderVariableParams gameOrderVariableParams) { foreach (OrderableObject orderableObject in orderableObjects) { gameOrderVariableParams.ObjectToOrder = orderableObject.gameObject; GameOrder order = gameOrderInitParams.CreateOrder(gameOrderVariableParams); orderableObject.GiveOrder(order); } }
public static void GiveOrderToUnits(OrderableObject orderableObject, GameOrderInitParams gameOrderInitParams, GameOrderVariableParams gameOrderVariableParams) { GameOrder order = gameOrderInitParams.CreateOrder(gameOrderVariableParams); orderableObject.GiveOrder(order); }
public static GameOrder CreateOrder(this GameOrderInitParams orderInitParams, GameOrderVariableParams orderVariableParams) { switch (orderInitParams) { case BuildOrderInitParams buildParams: return(new BuildOrder(orderVariableParams as BuildOrderVariableParams)); case AttackOrderInitParams attackParams: return(new AttackOrder(orderVariableParams as AttackOrderVariableParams)); case MoveOrderInitParams moveParams: return(new MoveOrder(orderVariableParams as MoveOrderVariableParams)); case MoveAttackOrderInitParams moveAtackParams: return(new MoveAttackOrder(orderVariableParams as MoveAttackOrderVariableParams)); case UnitCreationOrderInitParams unitCreationOrderInitParams: return(new UnitCreationOrder(unitCreationOrderInitParams, orderVariableParams as UnitCreationOrderVariableParams)); default: throw new ArgumentOutOfRangeException(paramName: "orderInitParams"); } }