Пример #1
0
 internal override void Tick(float dt)
 {
     if (!this._noProperLaneRemains)
     {
         List <SiegeLane> siegeLaneList = new List <SiegeLane>();
         foreach (SiegeLane siegeLane in TeamAISiegeComponent.SiegeLanes)
         {
             siegeLane.RefreshLane();
             siegeLane.DetermineLaneState();
         }
         if (!TeamAISiegeComponent.SiegeLanes.Any <SiegeLane>())
         {
             this._noProperLaneRemains = true;
             foreach (FormationAI.BehaviorSide behaviorSide in this.CastleKeyPositions.Where <MissionObject>((Func <MissionObject, bool>)(ckp => ckp is CastleGate && (ckp as CastleGate).DefenseSide != FormationAI.BehaviorSide.BehaviorSideNotSet)).Select <MissionObject, FormationAI.BehaviorSide>((Func <MissionObject, FormationAI.BehaviorSide>)(ckp => (ckp as CastleGate).DefenseSide)))
             {
                 FormationAI.BehaviorSide difficultLaneSide = behaviorSide;
                 SiegeLane siegeLane = new SiegeLane(difficultLaneSide, TeamAISiegeComponent.QuerySystem);
                 siegeLane.SetPrimarySiegeWeapons(new List <IPrimarySiegeWeapon>());
                 siegeLane.SetDefensePoints(this.CastleKeyPositions.Where <MissionObject>((Func <MissionObject, bool>)(ckp => (ckp as ICastleKeyPosition).DefenseSide == difficultLaneSide && ckp is CastleGate)).Select <MissionObject, ICastleKeyPosition>((Func <MissionObject, ICastleKeyPosition>)(dp => dp as ICastleKeyPosition)).ToList <ICastleKeyPosition>());
                 siegeLane.RefreshLane();
                 siegeLane.DetermineLaneState();
                 TeamAISiegeComponent.SiegeLanes.Add(siegeLane);
             }
         }
     }
     else
     {
         foreach (SiegeLane siegeLane in TeamAISiegeComponent.SiegeLanes)
         {
             siegeLane.RefreshLane();
             siegeLane.DetermineLaneState();
         }
     }
     base.Tick(dt);
 }
 public void OnDeploymentFinished()
 {
     TeamAISiegeComponent.SiegeLanes.Clear();
     for (int i = 0; i < 3; i++)
     {
         TeamAISiegeComponent.SiegeLanes.Add(new SiegeLane((FormationAI.BehaviorSide)i, TeamAISiegeComponent.QuerySystem));
         SiegeLane siegeLane = TeamAISiegeComponent.SiegeLanes[i];
         siegeLane.SetPrimarySiegeWeapons(this.PrimarySiegeWeapons.Where <SiegeWeapon>((Func <SiegeWeapon, bool>)(psw => psw is IPrimarySiegeWeapon && (psw as IPrimarySiegeWeapon).WeaponSide == (FormationAI.BehaviorSide)i)).Select <SiegeWeapon, IPrimarySiegeWeapon>((Func <SiegeWeapon, IPrimarySiegeWeapon>)(um => um as IPrimarySiegeWeapon)).ToList <IPrimarySiegeWeapon>());
         siegeLane.SetDefensePoints(this.CastleKeyPositions.Where <MissionObject>((Func <MissionObject, bool>)(ckp => (ckp as ICastleKeyPosition).DefenseSide == (FormationAI.BehaviorSide)i)).Select <MissionObject, ICastleKeyPosition>((Func <MissionObject, ICastleKeyPosition>)(dp => dp as ICastleKeyPosition)).ToList <ICastleKeyPosition>());
         siegeLane.RefreshLane();
         siegeLane.DetermineLaneState();
         siegeLane.DetermineOrigins();
     }
     TeamAISiegeComponent.QuerySystem = new SiegeQuerySystem(this.Team, (IEnumerable <SiegeLane>)TeamAISiegeComponent.SiegeLanes);
     TeamAISiegeComponent.QuerySystem.Expire();
     TeamAISiegeComponent.SiegeLanes.ForEach((Action <SiegeLane>)(sl => sl.SetSiegeQuerySystem(TeamAISiegeComponent.QuerySystem)));
     this.ArcherPositions.ForEach((Action <ArcherPosition>)(ap => ap.OnDeploymentFinished(TeamAISiegeComponent.QuerySystem, BattleSideEnum.Defender)));
 }