Exemplo n.º 1
0
        private void SpawnMaxFighters()
        {
            if (this.m_Game.Game.ScriptModules.Locust == null || this.m_MaxNumFightersTotal <= 0)
            {
                return;
            }
            int    num         = Math.Min(Math.Max(Math.Min(this.m_MaxNumFighters, this.m_MaxNumFightersTotal) - (this.m_LoadingFighters.Count + this.m_SpawnedFighters.Count), 0), Math.Max(this.m_LocustNest.BattleRiderMounts.Count <BattleRiderMount>() - this.m_LoadingFighters.Count, 0));
            Matrix rotationYpr = Matrix.CreateRotationYPR(this.m_LocustNest.Maneuvering.Rotation);

            rotationYpr.Position = this.m_LocustNest.Maneuvering.Position;
            int needleShipDesignId = this.m_Game.Game.ScriptModules.Locust.NeedleShipDesignId;

            for (int index = 0; index < num; ++index)
            {
                Ship newShip = CombatAIController.CreateNewShip(this.m_Game.Game, rotationYpr, needleShipDesignId, this.m_LocustNest.ObjectID, this.m_LocustNest.InputID, this.m_LocustNest.Player.ObjectID);
                if (newShip != null)
                {
                    this.m_LoadingFighters.Add(newShip);
                    --this.m_MaxNumFightersTotal;
                }
            }
            if (this.m_LoadingFighters.Count <= 0)
            {
                return;
            }
            this.m_State = LocustNestStates.INTEGRATEFIGHTER;
        }
Exemplo n.º 2
0
 private void ThinkIntegrateFighter()
 {
     if (this.m_LoadingFighters.Count == 0)
     {
         this.m_State = LocustNestStates.SEEK;
     }
     else
     {
         bool flag = true;
         foreach (GameObject loadingFighter in this.m_LoadingFighters)
         {
             if (loadingFighter.ObjectStatus != GameObjectStatus.Ready)
             {
                 flag = false;
             }
         }
         if (!flag)
         {
             return;
         }
         foreach (Ship loadingFighter in this.m_LoadingFighters)
         {
             loadingFighter.Player = this.m_LocustNest.Player;
             loadingFighter.Active = true;
             this.m_Game.CurrentState.AddGameObject((IGameObject)loadingFighter, false);
         }
         this.m_State = LocustNestStates.SEEK;
     }
 }
Exemplo n.º 3
0
        private void ThinkWaitForLaunch()
        {
            List <Ship> shipList = new List <Ship>();

            foreach (Ship launchingFighter in this.m_LaunchingFighters)
            {
                if (!launchingFighter.DockedWithParent)
                {
                    shipList.Add(launchingFighter);
                }
            }
            foreach (Ship ship in shipList)
            {
                this.m_LaunchingFighters.Remove(ship);
            }
            if (this.m_LaunchingFighters.Count != 0)
            {
                return;
            }
            if (this.m_LoadingFighters.Count + this.m_SpawnedFighters.Count < this.m_MaxNumFighters)
            {
                this.m_State = LocustNestStates.EMITFIGHTER;
            }
            else
            {
                this.m_State = LocustNestStates.SEEK;
            }
        }
Exemplo n.º 4
0
 private void ThinkTrack()
 {
     if (this.m_LoadingFighters.Count + this.m_SpawnedFighters.Count < this.m_MaxNumFighters)
     {
         this.m_State = LocustNestStates.EMITFIGHTER;
     }
     else if (this.m_Target == null)
     {
         this.m_State = LocustNestStates.SEEK;
     }
     else
     {
         Vector3 targetPos = Vector3.Zero;
         if (this.m_Target is StellarBody)
         {
             targetPos = (this.m_Target as StellarBody).Parameters.Position;
         }
         else if (this.m_Target is Ship)
         {
             targetPos = (this.m_Target as Ship).Position;
         }
         Vector3 look = targetPos - this.m_LocustNest.Maneuvering.Position;
         look.Y = 0.0f;
         double num = (double)look.Normalize();
         this.m_LocustNest.Maneuvering.PostAddGoal(targetPos, look);
         if (this.m_LocustNest.Target == this.m_Target)
         {
             return;
         }
         this.m_LocustNest.SetShipTarget(this.m_Target.ObjectID, Vector3.Zero, true, 0);
     }
 }
Exemplo n.º 5
0
 private void ThinkLaunch()
 {
     if (this.m_LaunchingFighters.Count == 0)
     {
         this.m_State = LocustNestStates.SEEK;
     }
     else
     {
         this.m_LocustNest.PostSetProp("LaunchBattleriders");
         this.m_State = LocustNestStates.WAITFORLAUNCH;
     }
 }
Exemplo n.º 6
0
 private void ThinkSeek()
 {
     if (this.m_LoadingFighters.Count + this.m_SpawnedFighters.Count < this.m_MaxNumFighters)
     {
         this.m_State = LocustNestStates.EMITFIGHTER;
     }
     else if (this.m_Target != null)
     {
         this.m_State = LocustNestStates.TRACK;
     }
     else
     {
         this.PickTarget();
     }
 }
Exemplo n.º 7
0
        private void ThinkWaitForDocked()
        {
            bool flag = true;

            foreach (Ship launchingFighter in this.m_LaunchingFighters)
            {
                if (!launchingFighter.DockedWithParent)
                {
                    flag = false;
                    break;
                }
            }
            if (!flag)
            {
                return;
            }
            this.m_State = LocustNestStates.LAUNCHFIGHTER;
        }
Exemplo n.º 8
0
 public void AddFighter(CombatAIController fighter)
 {
     if (fighter is LocustFighterControl)
     {
         foreach (Ship loadingFighter in this.m_LoadingFighters)
         {
             if (loadingFighter == fighter.GetShip())
             {
                 this.m_LoadingFighters.Remove(loadingFighter);
                 this.m_LaunchingFighters.Add(loadingFighter);
                 break;
             }
         }
         this.m_SpawnedFighters.Add(fighter as LocustFighterControl);
     }
     if (this.m_LoadingFighters.Count != 0)
     {
         return;
     }
     this.m_State = LocustNestStates.WAITFORDOCKED;
 }
Exemplo n.º 9
0
        public override void Initialize()
        {
            this.m_LoadingFighters    = new List <Ship>();
            this.m_LaunchingFighters  = new List <Ship>();
            this.m_SpawnedFighters    = new List <LocustFighterControl>();
            this.m_Planets            = new List <StellarBody>();
            this.m_State              = LocustNestStates.SEEK;
            this.m_Target             = (IGameObject)null;
            this.m_MaxNumFighters     = this is LocustMoonControl ? this.m_Game.AssetDatabase.GlobalLocustData.MaxMoonCombatDrones : this.m_Game.AssetDatabase.GlobalLocustData.MaxCombatDrones;
            this.m_NumDestroyedDrones = 0;
            this.m_UpdateListDelay    = 0;
            this.m_UpdateTargetList   = false;
            this.m_LocustNest.PostSetProp("SetAsOnlyLaunchCarrier", true);
            this.m_NumLocustsReachedPlanet = this.m_Game.AssetDatabase.GlobalLocustData.NumToLand;
            if (this is LocustMoonControl)
            {
                this.m_LocustNest.Maneuvering.TargetFacingAngle = TargetFacingAngle.BroadSide;
            }
            LocustSwarmInfo locustSwarmInfo = this.m_Game.GameDatabase.GetLocustSwarmInfos().ToList <LocustSwarmInfo>().FirstOrDefault <LocustSwarmInfo>((Func <LocustSwarmInfo, bool>)(x =>
            {
                int?fleetId1 = x.FleetId;
                int fleetId2 = this.m_FleetID;
                if (fleetId1.GetValueOrDefault() == fleetId2)
                {
                    return(fleetId1.HasValue);
                }
                return(false);
            }));

            this.m_LocustSwarmID       = 0;
            this.m_MaxNumFightersTotal = this.m_Game.AssetDatabase.GlobalLocustData.MaxDrones;
            if (locustSwarmInfo != null)
            {
                this.m_LocustSwarmID       = locustSwarmInfo.Id;
                this.m_MaxNumFightersTotal = locustSwarmInfo.NumDrones;
            }
            this.SpawnMaxFighters();
        }