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; }
public override void Initialize() { this.m_Target = (IGameObject)null; this.m_ParentBerserker = (VonNeumannNeoBerserkerControl)null; this.m_State = VonNeumannDiscStates.SEEK; this.m_PodsLaunched = false; this.m_Discs = new List <VonNeumannDiscControl>(); this.m_PossessorBoardingPods = new List <Ship>(); this.m_UpdateDelay = 0; if (this.m_DiscType != VonNeumannDiscTypes.POSSESSOR) { return; } Matrix rotationYpr = Matrix.CreateRotationYPR(this.m_Disc.Maneuvering.Rotation); rotationYpr.Position = this.m_Disc.Maneuvering.Position; int num = this.m_Disc.BattleRiderMounts.Count <BattleRiderMount>(); for (int index = 0; index < num; ++index) { Ship newShip = CombatAIController.CreateNewShip(this.m_Game.Game, rotationYpr, VonNeumann.StaticShipDesigns[VonNeumann.VonNeumannShipDesigns.BoardingPod].DesignId, this.m_Disc.ObjectID, this.m_Disc.InputID, this.m_Disc.Player.ObjectID); if (newShip != null) { this.m_PossessorBoardingPods.Add(newShip); } } this.m_State = VonNeumannDiscStates.ACTIVATEBOARDINGPODS; }
private void SpawnSmallerMeteors() { if (!this.m_CanSubDivide || this.m_Meteor.InstantlyKilled) { return; } this.m_CanSubDivide = false; Random random = new Random(); Vector3 forward = this.m_Target != null ? this.m_Target.Parameters.Position - this.m_Meteor.Maneuvering.Position : this.m_TargetPosition - this.m_Meteor.Maneuvering.Position; double num1 = (double)forward.Normalize(); Matrix world = Matrix.CreateWorld(this.m_Meteor.Maneuvering.Position, forward, Vector3.UnitY); Sphere shipSphere = this.m_Meteor.ShipSphere; int numBreakoffMeteors = this.m_Game.AssetDatabase.GlobalMeteorShowerData.NumBreakoffMeteors; float radians = MathHelper.DegreesToRadians(30f); List <int> subMeteorDesignIds = MeteorCombatAIControl.GetAvailableSubMeteorDesignIDs(this.m_Game, this.m_Size); if (subMeteorDesignIds.Count <= 0) { return; } for (int index = 0; index < numBreakoffMeteors; ++index) { Vector3 vector3 = new Vector3(); vector3.X = (random.CoinToss(0.5) ? -1f : 1f) * random.NextInclusive(10f, 85f); vector3.Y = (random.CoinToss(0.5) ? -1f : 1f) * random.NextInclusive(10f, 85f); vector3.Z = (random.CoinToss(0.5) ? -1f : 1f) * random.NextInclusive(10f, 85f); double num2 = (double)vector3.Normalize(); vector3 *= random.NextInclusive(shipSphere.radius * 0.1f, shipSphere.radius); Matrix worldMat = Matrix.PolarDeviation(random, radians); worldMat.Position = vector3; worldMat *= world; int designId = subMeteorDesignIds[random.NextInclusive(0, subMeteorDesignIds.Count - 1)]; this.m_Game.CurrentState.AddGameObject((IGameObject)CombatAIController.CreateNewShip(this.m_Game.Game, worldMat, designId, 0, this.m_Meteor.InputID, this.m_Meteor.Player.ObjectID), true); } }
private void ThinkEmitChild() { VonNeumannChildSpawnLocations childSpawnLocations = this.m_SpawnLocations.FirstOrDefault <VonNeumannChildSpawnLocations>((Func <VonNeumannChildSpawnLocations, bool>)(x => x.CanSpawnAtLocation())); if (childSpawnLocations == null) { return; } Matrix rotationYpr = Matrix.CreateRotationYPR(this.m_VonNeumannMom.Maneuvering.Rotation); rotationYpr.Position = childSpawnLocations.GetSpawnLocation(); Ship newShip = CombatAIController.CreateNewShip(this.m_Game.Game, rotationYpr, VonNeumann.StaticShipDesigns[VonNeumann.VonNeumannShipDesigns.CollectorProbe].DesignId, 0, this.m_VonNeumannMom.InputID, this.m_VonNeumannMom.Player.ObjectID); newShip.Maneuvering.RetreatDestination = this.m_VonNeumannMom.Maneuvering.RetreatDestination; if (newShip == null) { this.m_State = VonNeumannMomStates.COLLECT; } else { childSpawnLocations.SpawnAtLocation(newShip); this.m_RUStore -= this.m_Game.AssetDatabase.GlobalVonNeumannData.ChildRUCost; this.m_State = VonNeumannMomStates.INTEGRATECHILD; this.m_LoadingChilds.Add(newShip); } }
private void ThinkEmitMom() { this.m_RUStore -= this.m_Game.AssetDatabase.GlobalVonNeumannData.MomRUCost; Matrix rotationYpr = Matrix.CreateRotationYPR(this.m_VonNeumannMom.Maneuvering.Rotation); rotationYpr.Position = this.m_VonNeumannMom.Maneuvering.Position + rotationYpr.Forward * 500f; Ship newShip = CombatAIController.CreateNewShip(this.m_Game.Game, rotationYpr, VonNeumann.StaticShipDesigns[VonNeumann.VonNeumannShipDesigns.CollectorMothership].DesignId, 0, this.m_VonNeumannMom.InputID, this.m_VonNeumannMom.Player.ObjectID); if (newShip == null) { this.m_State = VonNeumannMomStates.COLLECT; } else { this.m_RUStore -= this.m_Game.AssetDatabase.GlobalVonNeumannData.ChildRUCost; this.m_State = VonNeumannMomStates.INTEGRATEMOM; this.m_LoadingMom = newShip; } }
public override void Initialize() { base.Initialize(); this.m_FormationInitialized = false; this.m_LoadingPyramids = new List <Ship>(); this.m_Pyramids = new List <VonNeumannPyramidControl>(); Matrix rotationYpr = Matrix.CreateRotationYPR(this.m_VonNeumannBerserker.Maneuvering.Rotation); rotationYpr.Position = this.m_VonNeumannBerserker.Maneuvering.Position; int designId = VonNeumann.StaticShipDesigns[VonNeumann.VonNeumannShipDesigns.Pyramid].DesignId; for (int index = 0; index < 14; ++index) { Ship newShip = CombatAIController.CreateNewShip(this.m_Game.Game, rotationYpr, designId, this.m_VonNeumannBerserker.ObjectID, this.m_VonNeumannBerserker.InputID, this.m_VonNeumannBerserker.Player.ObjectID); if (newShip != null) { this.m_LoadingPyramids.Add(newShip); } } this.m_PyramidsLaunched = false; this.m_State = VonNeumannBerserkerStates.INTEGRATECHILDS; }
public override void Initialize() { this.m_LoadingDiscs = new List <Ship>(); this.m_Discs = new List <VonNeumannDiscControl>(); this.m_DiscsActivated = false; Matrix rotationYpr = Matrix.CreateRotationYPR(this.m_VonNeumannBerserker.Maneuvering.Rotation); rotationYpr.Position = this.m_VonNeumannBerserker.Maneuvering.Position; float radians = MathHelper.DegreesToRadians(36f); for (int index = 0; index < 10; ++index) { Matrix worldMat = Matrix.CreateRotationY((float)index * radians) * rotationYpr; worldMat.Position += worldMat.Forward * 500f; int num = 5 + index; Ship newShip = CombatAIController.CreateNewShip(this.m_Game.Game, worldMat, VonNeumann.StaticShipDesigns[(VonNeumann.VonNeumannShipDesigns)num].DesignId, this.m_VonNeumannBerserker.ObjectID, this.m_VonNeumannBerserker.InputID, this.m_VonNeumannBerserker.Player.ObjectID); if (newShip != null) { this.m_LoadingDiscs.Add(newShip); } } this.m_State = VonNeumannBerserkerStates.INTEGRATECHILDS; }
public override void Initialize() { this.m_VonNeumannSeekerPods = new List <Ship>(); this.m_LoadingPods = new List <Ship>(); this.m_AvailableTargets = new List <PlanetTarget>(); this.m_CurrentTarget = (StellarBody)null; this.m_State = VonNeumannSeekerStates.SEEK; this.m_Vanished = false; Matrix rotationYpr = Matrix.CreateRotationYPR(this.m_VonNeumannSeeker.Maneuvering.Rotation); rotationYpr.Position = this.m_VonNeumannSeeker.Maneuvering.Position; int designId = VonNeumann.StaticShipDesigns[VonNeumann.VonNeumannShipDesigns.SeekerProbe].DesignId; for (int index = 0; index < 12; ++index) { Ship newShip = CombatAIController.CreateNewShip(this.m_Game.Game, rotationYpr, designId, this.m_VonNeumannSeeker.ObjectID, this.m_VonNeumannSeeker.InputID, this.m_VonNeumannSeeker.Player.ObjectID); if (newShip != null) { this.m_LoadingPods.Add(newShip); ++this.m_NumPodsRemain; } } this.m_State = VonNeumannSeekerStates.INTEGRATECHILD; }
private void SpawnMaxSwarmerAttackers(Swarmers swarmers) { if (this.m_MaxToCreate <= 0) { return; } Matrix rotationYpr = Matrix.CreateRotationYPR(this.m_SwarmerSpawner.Maneuvering.Rotation); rotationYpr.Position = this.m_SwarmerSpawner.Maneuvering.Position; int num1 = Math.Max(this.m_SwarmerSpawner.BattleRiderMounts.Count <BattleRiderMount>() - (this.m_LoadingSwarmers.Count + this.m_LoadingGuardians.Count + this.m_LaunchingShips.Count), 0); if (num1 == 0) { return; } int val2_1 = Math.Max(this.m_MaxSwarmers - (this.m_LoadingSwarmers.Count + this.m_SpawnedSwarmers.Count), 0); int val2_2 = Math.Max(this.m_MaxGuardians - (this.m_LoadingGuardians.Count + this.m_SpawnedGuardians.Count), 0); if (val2_1 + val2_2 == 0) { return; } int num2 = Math.Min(num1 / 2, val2_1); int num3 = Math.Min(num1 - num2, val2_2); int num4 = Math.Min(num2 + Math.Max(num1 - (num2 + num3), 0), val2_1); int num5 = num4 + num3; for (int index = 0; index < num5; ++index) { int designId; if (num4 > 0 && (index % 2 == 0 || num3 == 0)) { designId = swarmers.SwarmerDesignID; --num4; } else if (num3 > 0) { designId = swarmers.GuardianDesignID; --num3; } else { break; } Ship newShip = CombatAIController.CreateNewShip(this.m_Game.Game, rotationYpr, designId, this.m_SwarmerSpawner.ObjectID, this.m_SwarmerSpawner.InputID, this.m_SwarmerSpawner.Player.ObjectID); if (newShip != null) { if (designId == swarmers.GuardianDesignID) { this.m_LoadingGuardians.Add(newShip); } else { this.m_LoadingSwarmers.Add(newShip); } --this.m_MaxToCreate; } if (this.m_MaxToCreate <= 0) { break; } } if (this.m_LoadingSwarmers.Count <= 0 && this.m_LoadingGuardians.Count <= 0) { return; } this.m_State = SwarmerSpawnerStates.INTEGRATESWARMER; }
public override void Initialize() { this.m_LoadingMom = (Ship)null; this.m_LoadingChilds = new List <Ship>(); this.m_SpawnedChilds = new List <VonNeumannChildControl>(); this.m_SpawnedMoms = new List <VonNeumannMomControl>(); this.m_SpawnLocations = new List <VonNeumannChildSpawnLocations>(); this.m_SpawnedDefensePlatforms = new List <Ship>(); this.m_SpawnedEnemies = new List <Ship>(); this.m_State = VonNeumannMomStates.COLLECT; this.m_Orders = VonNeumannOrders.COLLECT; this.m_NumChildrenToMaintain = 10; this.m_Vanished = false; this.m_TryFindParent = true; this.m_VonNeumannID = 0; VonNeumannInfo vonNeumannInfo = this.m_Game.GameDatabase.GetVonNeumannInfos().ToList <VonNeumannInfo>().FirstOrDefault <VonNeumannInfo>((Func <VonNeumannInfo, bool>)(x => { int?fleetId1 = x.FleetId; int fleetId2 = this.m_FleetID; if (fleetId1.GetValueOrDefault() == fleetId2) { return(fleetId1.HasValue); } return(false); })); if (vonNeumannInfo != null) { this.m_VonNeumannID = vonNeumannInfo.Id; } Matrix rotationYpr = Matrix.CreateRotationYPR(this.m_VonNeumannMom.Maneuvering.Rotation); rotationYpr.Position = this.m_VonNeumannMom.Maneuvering.Position + rotationYpr.Forward * 500f; Vector3 right = rotationYpr.Right; int designId = VonNeumann.StaticShipDesigns[VonNeumann.VonNeumannShipDesigns.CollectorProbe].DesignId; int childrenToMaintain1 = this.m_NumChildrenToMaintain; float radians = MathHelper.DegreesToRadians(360f / (float)childrenToMaintain1); float num1 = radians * 0.5f; float num2 = 1f; for (int index = 0; index < childrenToMaintain1; ++index) { float num3 = radians * (float)((index % childrenToMaintain1 + 1) / 2) * num2 + num1; this.m_SpawnLocations.Add(new VonNeumannChildSpawnLocations(this.m_VonNeumannMom, new Vector3((float)Math.Sin((double)num3), 0.0f, -(float)Math.Cos((double)num3)), 300f)); num2 *= -1f; } int childrenToMaintain2 = this.m_Game.AssetDatabase.GlobalVonNeumannData.MinChildrenToMaintain; for (int index = 0; index < childrenToMaintain2; ++index) { VonNeumannChildSpawnLocations childSpawnLocations = this.m_SpawnLocations.FirstOrDefault <VonNeumannChildSpawnLocations>((Func <VonNeumannChildSpawnLocations, bool>)(x => x.CanSpawnAtLocation())); if (childSpawnLocations != null) { Matrix worldMat = rotationYpr; worldMat.Position = childSpawnLocations.GetSpawnLocation(); Ship newShip = CombatAIController.CreateNewShip(this.m_Game.Game, worldMat, designId, 0, this.m_VonNeumannMom.InputID, this.m_VonNeumannMom.Player.ObjectID); if (newShip != null) { this.m_LoadingChilds.Add(newShip); childSpawnLocations.SpawnAtLocation(newShip); } } } if (this.m_LoadingChilds.Count <= 0) { return; } this.m_State = VonNeumannMomStates.INTEGRATECHILD; }