public static void AddSpecificBehavior( this IEnumerable <FormationAI> ais, BehaviorComponent behaviour) { foreach (FormationAI ai in ais) { ai.AddSpecificBehavior(behaviour); } }
private float GetFormationBehaviourLaneEffectiveness( SiegeLane siegeLane, Formation formation, BehaviorComponent behaviour) { switch (behaviour) { case BehaviorAssaultWalls _: return((float)((formation.AI.Side == siegeLane.LaneSide ? 5.0 : 1.0) * (formation.AI.ActiveBehavior == null || !(formation.AI.ActiveBehavior.GetType() == behaviour.GetType()) ? 1.0 : 3.0)) * TacticComponent.GetFormationEffectivenessOverOrder(formation, OrderType.Charge) * siegeLane.PrimarySiegeWeapons.Where <IPrimarySiegeWeapon>((Func <IPrimarySiegeWeapon, bool>)(psw => psw.HasCompletedAction())).Max <IPrimarySiegeWeapon>((Func <IPrimarySiegeWeapon, float>)(psw => psw.SiegeWeaponPriority))); case BehaviorUseSiegeMachines _: return((float)((formation.AI.Side == siegeLane.LaneSide ? 5.0 : 1.0) * (formation.AI.ActiveBehavior == null || !(formation.AI.ActiveBehavior.GetType() == behaviour.GetType()) ? 1.0 : 3.0)) * TacticComponent.GetFormationEffectivenessOverOrder(formation, OrderType.Charge) * siegeLane.PrimarySiegeWeapons.Where <IPrimarySiegeWeapon>((Func <IPrimarySiegeWeapon, bool>)(psw => !psw.HasCompletedAction())).Max <IPrimarySiegeWeapon>((Func <IPrimarySiegeWeapon, float>)(psw => psw.SiegeWeaponPriority))); default: return(0.0f); } }
public static void AddAiSpecificBehavior( this IEnumerable <Formation> formations, BehaviorComponent behaviour) { formations.Select <Formation, FormationAI>((Func <Formation, FormationAI>)(f => f.AI)).AddSpecificBehavior(behaviour); }