protected TeamAISiegeComponent( Mission currentMission, Team currentTeam, float thinkTimerTime, float applyTimerTime) : base(currentMission, currentTeam, thinkTimerTime, applyTimerTime) { this.CastleGates = (IEnumerable <CastleGate>)currentMission.ActiveMissionObjects.FindAllWithType <CastleGate>().ToList <CastleGate>(); this.WallSegments = (IEnumerable <WallSegment>)currentMission.ActiveMissionObjects.FindAllWithType <WallSegment>().ToList <WallSegment>(); this.OuterGate = this.CastleGates.FirstOrDefault <CastleGate>((Func <CastleGate, bool>)(g => g.GameEntity.HasTag("outer_gate"))); this.InnerGate = this.CastleGates.FirstOrDefault <CastleGate>((Func <CastleGate, bool>)(g => g.GameEntity.HasTag("inner_gate"))); this._ladders = currentMission.ActiveMissionObjects.FindAllWithType <SiegeLadder>(); this.Ram = currentMission.ActiveMissionObjects.FindAllWithType <BatteringRam>().FirstOrDefault <BatteringRam>(); this.SiegeTowers = currentMission.ActiveMissionObjects.FindAllWithType <SiegeTower>().ToList <SiegeTower>(); this.PrimarySiegeWeapons = new List <SiegeWeapon>(); this.PrimarySiegeWeapons.AddRange((IEnumerable <SiegeWeapon>) this._ladders); if (this.Ram != null) { this.PrimarySiegeWeapons.Add((SiegeWeapon)this.Ram); } this.PrimarySiegeWeapons.AddRange((IEnumerable <SiegeWeapon>) this.SiegeTowers); this.CastleKeyPositions = new List <MissionObject>(); this.CastleKeyPositions.AddRange((IEnumerable <MissionObject>) this.CastleGates); this.CastleKeyPositions.AddRange((IEnumerable <MissionObject>) this.WallSegments); TeamAISiegeComponent.SiegeLanes = new List <SiegeLane>(); for (int i = 0; i < 3; i++) { TeamAISiegeComponent.SiegeLanes.Add(new SiegeLane((FormationAI.BehaviorSide)i, TeamAISiegeComponent.QuerySystem)); TeamAISiegeComponent.SiegeLanes[i].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>()); TeamAISiegeComponent.SiegeLanes[i].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>()); TeamAISiegeComponent.SiegeLanes[i].RefreshLane(); } TeamAISiegeComponent.SiegeLanes.ForEach((Action <SiegeLane>)(sl => sl.SetSiegeQuerySystem(TeamAISiegeComponent.QuerySystem))); }
public BehaviorUseMurderHole(Formation formation) : base(formation) { this.behaviorSide = formation.AI.Side; WorldPosition position = new WorldPosition(Mission.Current.Scene, UIntPtr.Zero, (formation.Team.TeamAI as TeamAISiegeDefender).MurderHolePosition, false); this._outerGate = (formation.Team.TeamAI as TeamAISiegeDefender).OuterGate; this._innerGate = (formation.Team.TeamAI as TeamAISiegeDefender).InnerGate; this._batteringRam = Mission.Current.ActiveMissionObjects.FindAllWithType <BatteringRam>().FirstOrDefault <BatteringRam>(); this.CurrentOrder = MovementOrder.MovementOrderMove(position); this.BehaviorCoherence = 0.0f; }