Beispiel #1
0
        public override void Destroy()
        {
            int Mult = Big ? 2 : 1;

            Vector3 Position3 = new Vector3(Position.X(), Y, Position.Y());

            for (int i = 0; i < 10; i++)
            {
                ParticleManager.CreateParticle(Position3, Rand.V3() * 200, ParticleColor, 20 * Mult, 5);
            }

            FlareSystem.AddLightingPoint(Position3, new Vector3(1, 0.25f, 0.25f), new Vector3(0.5f, 0, 0.25f), 5 * Mult, 20 * Mult, 3, 5);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 400 * Mult, 5);
            for (int i = 0; i < 3; i++)
            {
                FlamingChunkSystem.AddParticle(Position3, Rand.V3() / 4, Vector3.Zero, Rand.V3() * Mult, Vector3.Zero, 20 * Mult, 10, ParticleColor.ToVector3(), ParticleColor.ToVector3(), 0, 2);
            }

            base.Destroy();
        }
        public override void BlowUp()
        {
            if (!Dead)
            {
                QuadGrid quad = Parent2DScene.quadGrids.First.Value;
                foreach (Basic2DObject o in quad.Enumerate(Position.get(), new Vector2(EffectDistance * 2)))
                {
                    if (o.GetType().IsSubclassOf(typeof(UnitShip)) && Vector2.Distance(Position.get(), o.Position.get()) < EffectDistance)
                    {
                        UnitShip s = (UnitShip)o;
                        if (s.CanBeTargeted())
                        {
                            s.CanDeathSound = false;
                            s.CanCloak      = false;
                            s.Damage(4, 0, Vector2.Zero, this, AttackType.Blue);
                            s.LastDamager   = this;
                            s.StunState     = AttackType.Blue;
                            s.FreezeTime    = StasisTime;
                            s.CanDeathSound = true;
                        }
                    }
                }

                Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());
                for (int i = 0; i < 30; i++)
                {
                    ParticleManager.CreateParticle(Position3, Rand.V3() * MaxEngagementDistance * 3, ParticleColor, 40, 5);
                }

                for (int i = 0; i < 2; i++)
                {
                    FlareSystem.AddLightingPoint(Position3, new Vector3(0.3f), new Vector3(0, 0, 1), MaxEngagementDistance / 10, 40, 5, 10);
                    ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, MaxEngagementDistance * 6, 5);
                    ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, MaxEngagementDistance * 3, 4);
                }
            }
            base.BlowUp();
        }
Beispiel #3
0
        public override void Destroy()
        {
            this.Armed = true;

            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());

            for (int i = 0; i < 30; i++)
            {
                ParticleManager.CreateParticle(Position3, Rand.V3() * 600, ParticleColor, 30, 5);
            }

            for (int i = 0; i < 2; i++)
            {
                FlareSystem.AddLightingPoint(Position3, new Vector3(0.3f), new Vector3(0, 0, 1), 25, 40, 5, 10);
                ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 1200, 5);
                ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 400, 4);
            }

            QuadGrid quadGrid = Parent2DScene.quadGrids.First.Value;

            foreach (GameObject g in quadGrid.Enumerate(Position.get(), new Vector2(WinderMisslesAbility.ExplosionDistance)))
            {
                if (g.GetType().IsSubclassOf(typeof(UnitShip)))
                {
                    UnitShip s = (UnitShip)g;
                    if (Vector2.Distance(Position.get(), s.Position.get()) < WinderMisslesAbility.ExplosionDistance / 4)
                    {
                        s.StunState  = AttackType.White;
                        s.FreezeTime = 1000;
                        s.SetSpeed(Vector2.Normalize(s.Position.get() - Position.get()) * 12 / s.Mass);
                    }
                }
            }

            base.Destroy();
        }
        public override void Update(GameTime gameTime)
        {
            if (!Dead)
            {
                if (ShutDownTime > 0 || VirusTime > 0)
                {
                    ShutDownTime = 0;
                    VirusTime    = 0;
                }
                else
                {
                    SearchTime += gameTime.ElapsedGameTime.Milliseconds;

                    if (SearchTime > PulseSearchTime)
                    {
                        SearchTime -= PulseSearchTime;

                        bool     Found = false;
                        QuadGrid quad  = Parent2DScene.quadGrids.First.Value;

                        foreach (Basic2DObject o in quad.Enumerate(Position.get(), new Vector2(MaxEngagementDistance * 2)))
                        {
                            if (o.GetType().IsSubclassOf(typeof(UnitShip)))
                            {
                                UnitShip s = (UnitShip)o;
                                if (!s.Dead && !s.IsAlly(this) && Vector2.Distance(Position.get(), o.Position.get()) < MaxEngagementDistance)
                                {
                                    if (s.CanBeTargeted() && s.SnapBounce())
                                    {
                                        s.ShieldDamage = s.ShieldToughness + 1;
                                        s.LastDamager  = this;
                                        s.FreezeTime   = 1000;
                                        s.StunState    = AttackType.Melee;
                                        s.SetSpeed(Vector2.Normalize(s.Position.get() - Position.get()) * 16);
                                    }

                                    PulseSearchTime += (int)(StartingMaxSearchTime / 100f * (1.5f + s.UnitLevel));
                                    Found            = true;
                                }
                            }
                        }

                        if (Found)
                        {
                            SoundManager.Play3DSound("PulseTurretFire",
                                                     new Vector3(Position.X(), Y, Position.Y()),
                                                     0.75f, 800, 2);

                            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());
                            for (int i = 0; i < 30; i++)
                            {
                                ParticleManager.CreateParticle(Position3, Rand.V3() * MaxEngagementDistance / 1000f * 3, ParticleColor, 40, 5);
                            }

                            for (int i = 0; i < 2; i++)
                            {
                                FlareSystem.AddLightingPoint(Position3, new Vector3(0.3f), new Vector3(0, 0, 1), MaxEngagementDistance / 10, 40, 5, 10);
                                ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, MaxEngagementDistance * 6, 5);
                                ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, MaxEngagementDistance * 3, 4);
                            }
                        }
                    }
                }
            }
            base.Update(gameTime);
        }
Beispiel #5
0
        public override void Update(GameTime gameTime)
        {
            if (!Dead)
            {
                if (ShutDownTime > 0 || VirusTime > 0)
                {
                    if (ShutDownTime > 0)
                    {
                        ShutDownTime -= gameTime.ElapsedGameTime.Milliseconds * 3;
                    }
                    else
                    {
                        Rotation.set(Rotation.get() + MathHelper.ToRadians(gameTime.ElapsedGameTime.Milliseconds * 20));
                    }
                }
                else
                {
                    SearchTime += gameTime.ElapsedGameTime.Milliseconds;

                    if (SearchTime > SnapSearchTime)
                    {
                        SearchTime -= SnapSearchTime;

                        bool     Found = false;
                        QuadGrid quad  = Parent2DScene.quadGrids.First.Value;

                        foreach (Basic2DObject o in quad.Enumerate(Position.get(), new Vector2(MaxEngagementDistance * 2)))
                        {
                            if (o.GetType().IsSubclassOf(typeof(UnitShip)))
                            {
                                UnitShip s = (UnitShip)o;
                                if (!s.Dead && !s.IsAlly(this) && Vector2.Distance(Position.get(), o.Position.get()) < MaxEngagementDistance)
                                {
                                    if (s.CanBeTargeted() && s.SnapBounce())
                                    {
                                        s.EMP(this, IsUpdgraded ? 1 : 0);
                                    }
                                    SnapSearchTime += (int)(StartingMaxSearchTime / 20 * (1.5f + s.UnitLevel) / 2f);
                                    Found           = true;
                                }
                            }
                        }

                        if (Found)
                        {
                            SoundManager.Play3DSound("SnapTurretFire",
                                                     new Vector3(Position.X(), Y, Position.Y()),
                                                     0.75f, 800, 2);

                            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());
                            for (int i = 0; i < 30; i++)
                            {
                                ParticleManager.CreateParticle(Position3, Rand.V3() * MaxEngagementDistance / 1000f * 3, ParticleColor, 40, 5);
                            }

                            for (int i = 0; i < 2; i++)
                            {
                                FlareSystem.AddLightingPoint(Position3, new Vector3(0.3f), new Vector3(0, 0, 1), MaxEngagementDistance / 10, 40, 5, 10);
                                ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, MaxEngagementDistance * 6, 5);
                                ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, MaxEngagementDistance * 3, 4);
                            }
                        }
                    }
                }
            }
            base.Update(gameTime);
        }