Exemple #1
0
        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);
            }
        }
Exemple #2
0
        public override void Initialize()
        {
            this.m_State = SimpleAIStates.SEEK;
            this.m_VictoryConditionsMet = false;
            this.m_FailureConditionMet  = false;
            this.m_Planets           = new List <StellarBody>();
            this.m_UpdateRate        = 0;
            this.m_Size              = MeteorCombatAIControl.GetMeteorSize(this.m_Game, this.m_Meteor.DesignID);
            this.m_CanSubDivide      = MeteorCombatAIControl.CanSubDivide(this.m_Size);
            this.m_CanApplyResources = true;
            this.m_Target            = (StellarBody)null;
            this.m_TargetFacing      = -Vector3.UnitZ;
            this.m_TargetPosition    = Vector3.Zero;
            MeteorShowerGlobalData meteorShowerData = this.m_Game.Game.AssetDatabase.GlobalMeteorShowerData;

            this.m_Meteor.Maneuvering.PostSetProp("SetCombatAIDamage", (object)meteorShowerData.Damage[(int)this.m_Size].Crew, (object)meteorShowerData.Damage[(int)this.m_Size].Population, (object)meteorShowerData.Damage[(int)this.m_Size].InfraDamage, (object)meteorShowerData.Damage[(int)this.m_Size].TeraDamage);
        }