public TacticSallyOutDefense(Team team)
     : base(team)
 {
     this._teamAISallyOutDefender   = team.TeamAI as TeamAISallyOutDefender;
     this._destructableSiegeWeapons = Mission.Current.ActiveMissionObjects.FindAllWithType <SiegeWeapon>().Where <SiegeWeapon>((Func <SiegeWeapon, bool>)(sw => sw.Side == team.Side && sw.IsDestructible)).ToList <SiegeWeapon>();
     this.DetermineState();
     this.SallyOutDefensePosition = team.TeamAI is TeamAISallyOutDefender ? (team.TeamAI as TeamAISallyOutDefender).DefensePosition() : WorldPosition.Invalid;
     this.ManageFormationCounts();
     this.ApplyDefenseBasedOnState();
     this._AIControlledFormationCount = this.Formations.Count <Formation>((Func <Formation, bool>)(f => f.IsAIControlled));
 }
Esempio n. 2
0
        public TeamAISallyOutDefender(
            Mission currentMission,
            Team currentTeam,
            float thinkTimerTime,
            float applyTimerTime)
            : base(currentMission, currentTeam, thinkTimerTime, applyTimerTime)
        {
            TeamAISallyOutDefender sallyOutDefender = this;

            TeamAISiegeComponent.QuerySystem = new SiegeQuerySystem(this.Team, (IEnumerable <SiegeLane>)TeamAISiegeComponent.SiegeLanes);
            TeamAISiegeComponent.QuerySystem.Expire();
            this.DefensePosition = (Func <WorldPosition>)(() => new WorldPosition(currentMission.Scene, UIntPtr.Zero, sallyOutDefender.Ram.GameEntity.GlobalPosition, false));
            this.ArcherPositions = currentMission.Scene.FindEntitiesWithTag("archer_position").Where <GameEntity>((Func <GameEntity, bool>)(ap => (NativeObject)ap.Parent == (NativeObject)null || ap.Parent.IsVisibleIncludeParents())).Select <GameEntity, ArcherPosition>((Func <GameEntity, ArcherPosition>)(ap => new ArcherPosition(ap, TeamAISiegeComponent.QuerySystem))).ToList <ArcherPosition>();
            Mission.Current.GetMissionBehaviour <SiegeMissionController>().PlayerDeploymentFinish += new CampaignSiegeMissionEvent(this.OnDeploymentFinished);
        }