private void ThinkIntegrateChilds() { if (this.m_LoadingDiscs.Count == 0) { this.m_State = VonNeumannBerserkerStates.SEEK; } else { bool flag = true; foreach (GameObject loadingDisc in this.m_LoadingDiscs) { if (loadingDisc.ObjectStatus != GameObjectStatus.Ready) { flag = false; } } if (!flag) { return; } foreach (Ship loadingDisc in this.m_LoadingDiscs) { loadingDisc.Player = this.m_VonNeumannBerserker.Player; loadingDisc.Active = false; this.m_Game.CurrentState.AddGameObject((IGameObject)loadingDisc, false); } this.m_State = VonNeumannBerserkerStates.SEEK; } }
protected virtual void ThinkTrack() { if (this.m_Target != null) { return; } this.m_State = VonNeumannBerserkerStates.SEEK; }
public override void FindNewTarget(IEnumerable <IGameObject> objs) { List <Ship> shipList1 = new List <Ship>(); List <Ship> shipList2 = new List <Ship>(); foreach (IGameObject gameObject in objs) { if (gameObject is Ship) { Ship ship = gameObject as Ship; if (ship != this.m_VonNeumannBerserker && Ship.IsActiveShip(ship) && (ship.IsDetected(this.m_VonNeumannBerserker.Player) && ship.Player != this.m_VonNeumannBerserker.Player)) { shipList1.Add(ship); } } } foreach (VonNeumannDiscControl disc in this.m_Discs) { if (VonNeumannDiscControl.DiscTypeIsAttacker(disc.DiscType)) { shipList2.Add(disc.GetShip()); } } if (shipList1.Count == 0) { return; } if (!this.m_DiscsActivated) { this.m_State = VonNeumannBerserkerStates.ACTIVATINGDISCS; } foreach (VonNeumannDiscControl disc in this.m_Discs) { if (Ship.IsActiveShip(disc.GetShip()) && disc.RequestingNewTarget()) { Vector3 position = disc.GetShip().Position; float num = float.MaxValue; Ship ship1 = (Ship)null; foreach (Ship ship2 in VonNeumannDiscControl.DiscTypeIsAttacker(disc.DiscType) ? shipList1 : shipList2) { if (ship2 != disc.GetShip()) { float lengthSquared = (ship2.Position - position).LengthSquared; if ((double)lengthSquared < (double)num) { ship1 = ship2; num = lengthSquared; } } } if (ship1 != null) { disc.SetTarget((IGameObject)ship1); } } } }
protected virtual void ThinkSeek() { if (this.m_Target != null) { this.m_State = VonNeumannBerserkerStates.TRACK; } if (this.m_DiscsActivated || this is VonNeumannBerserkerControl) { return; } this.m_State = VonNeumannBerserkerStates.ACTIVATINGDISCS; }
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; }
protected virtual void ThinkActivatingDiscs() { Matrix rotationYpr = Matrix.CreateRotationYPR(this.m_VonNeumannBerserker.Maneuvering.Rotation); rotationYpr.Position = this.m_VonNeumannBerserker.Maneuvering.Position; float radians = MathHelper.DegreesToRadians(36f); int num = 0; foreach (VonNeumannDiscControl disc in this.m_Discs) { Ship ship = disc.GetShip(); Matrix matrix = Matrix.CreateRotationY((float)num * radians) * rotationYpr; ship.Position = matrix.Position + matrix.Forward * 500f; ship.Active = true; if (ship.Shield != null) { ship.Shield.Active = false; } disc.SetListOfDiscs(this.m_Discs); ++num; } this.m_DiscsActivated = true; this.m_State = VonNeumannBerserkerStates.SEEK; }