Example #1
0
        public override void Destroy()
        {
            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());

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

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 800, 5);


            for (int i = 0; i < 2; i++)
            {
                FlamingChunkSystem.AddParticle(Position3, Rand.V3() * 1.5f, new Vector3(0, -0.25f, 0),
                                               Rand.V3(), Rand.V3() / 10, 40, 30, new Vector3(1, 0.5f, 0.2f), new Vector3(1, 0.1f, 0.2f), 0, 3);
            }

            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), Size.X() * 12, 4);
            for (int i = 0; i < 30; i++)
            {
                ParticleManager.CreateParticle(Position3, Rand.V3() * 400, new Color(1, 0.75f, 0.5f), 50, 5);
            }

            Armed = true;
            base.Destroy();
        }
        public void VirusParticles()
        {
            Vector3 Position3 = new Vector3(Position.X(), Y, Position.Y());

            ParticleManager.CreateParticle(Position3, Rand.V3() * 200, VirusColor, 40, 5);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, VirusColor, Size.X() * (1 + Rand.F()) * 6, 1);
        }
        public void Rebuild()
        {
            if (!Dead || IsCrushed ||
                //!FactionManager.CanAfford(FactionNumber, RebuildCost) ||
                Lives < 1)
            {
                return;
            }

            ShouldDeathSound = true;

            //FactionManager.AddCells(FactionNumber, -RebuildCost);
            //TextParticleSystem.AddParticle(new Vector3(Position.X(), Y, Position.Y()), '-' + RebuildCost.ToString(), (byte)GetTeam());
            for (int i = 0; i < 10; i++)
            {
                ParticleManager.CreateParticle(new Vector3(Position.X(), Y, Position.Y()), Vector3.Zero, Color.White, Size.X(), 1);
            }

            BuildTimer = 0;
            Dead       = false;
            MyBustedTurret.Deactivate();
            InstanceManager.AddChild(this);
            AddTag(GameObjectTag._2DSolid);
            AddTag(GameObjectTag._2DForward);
            ShieldDamage = 0;
            HullDamage   = 0;
            FreezeTime   = 0;
        }
Example #4
0
        public override void Destroy()
        {
            Vector2 PreviousPosition = ParentUnit.Position.get();

            ParentUnit.Position.set(Position.get());

            scatterTurretFireMode.SetParent(ParentUnit);

            for (int i = 0; i < 8; i++)
            {
                scatterTurretFireMode.Fire((float)Math.PI * 2 / 8f * i);
            }

            ParentUnit.Position.set(PreviousPosition);

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

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

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 1000, 5);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 400, 0);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 400, 4);

            base.Destroy();
        }
        public override void Destroy()
        {
            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());

            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 1, 1), Size.X() * 30, 4);
            for (int i = 0; i < 30; i++)
            {
                ParticleManager.CreateParticle(Position3, Rand.V3() * 600, new Color(1, 1, 1), 60, 5);
            }
            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 1, 1), Size.X() * 8, 5);

            foreach (UnitTurret t in Damagers)
            {
                t.ShutDownTime = Math.Max(t.ShutDownTime, (int)(2000 * UnitLevel));

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

                ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 1, 1), t.Size.X() * 10, 4);
                for (int i = 0; i < 30; i++)
                {
                    ParticleManager.CreateParticle(Position3, Rand.V3() * 300, new Color(1, 1, 1), 30, 5);
                }
                ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 1, 1), t.Size.X() * 4, 5);
            }

            base.Destroy();
        }
        public override void Update2(GameTime gameTime)
        {
            if (GetIntType() != -1)
            {
                InstanceManager.EmitParticle(GetIntType(), new Vector3(Position.X(), Y, Position.Y()), ref RotationMatrix, 0, Size.X(), 1);
            }
            Vector3 Position3 = new Vector3(Position.X(), Y, Position.Y());

            ParticleManager.CreateRing(Position3, Size.X() * BuildingRingSizeMult, GetTeam());
            WorldMatrix = Matrix.CreateScale(Size.X()) * Matrix.CreateFromYawPitchRoll(Rotation.getAsRadians() + RotationOffset.X, RotationOffset.Y, RotationOffset.Z) * Matrix.CreateTranslation(Position3);

            if (FreezeTime > 0 && StunState != AttackType.None)
            {
                switch (StunState)
                {
                case AttackType.Blue:
                    ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(0.25f, 0.25f, 1), Size.X() * 5 * Rand.F(), 1);
                    break;

                case AttackType.Red:
                    ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.25f, 0.25f), Size.X() * 5 * Rand.F(), 1);
                    break;

                case AttackType.Green:
                    ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(0.25f, 1, 0.25f), Size.X() * 5 * Rand.F(), 1);
                    break;
                }
            }
        }
Example #7
0
        public override void Destroy()
        {
            QuadGrid quad = Parent2DScene.quadGrids.First.Value;

            foreach (Basic2DObject o in quad.Enumerate(Position.get(), new Vector2(GetEngagementDistance() * 2)))
            {
                if (o.GetType().IsSubclassOf(typeof(UnitBasic)))
                {
                    UnitBasic s = (UnitBasic)o;
                    if (!s.Dead && !s.IsAlly(this) && Vector2.Distance(Position.get(), o.Position.get()) < GetEngagementDistance())
                    {
                        s.ShutDownTime = Math.Max(s.ShutDownTime, (int)(1000 * UnitLevel));
                    }
                }
            }

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

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

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

            base.Destroy();
        }
        public override bool Trigger(PlayerShip p)
        {
            Vector3 Position3 = new Vector3(p.Position.X(), 0, p.Position.Y());

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

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 4000, 5);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 400, 7);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 300, 7);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 500, 7);

            for (int i = 0; i < 2; i++)
            {
                FlamingChunkSystem.AddParticle(Position3, Rand.V3() / 1.5f, new Vector3(0, -0.25f, 0),
                                               Rand.V3(), Rand.V3() / 10, 150, 30, new Vector3(0.2f, 0.5f, 1), new Vector3(0.2f, 0.5f, 1), 0, 3);
            }

            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(0.5f, 0.75f, 1), p.Size.X() * 50, 4);
            for (int i = 0; i < 30; i++)
            {
                ParticleManager.CreateParticle(Position3, Rand.V3() * 200, new Color(0.5f, 0.75f, 1), 200, 5);
            }

            p.InvTime = 10000;

            return(true);
        }
        public override void Destroy()
        {
            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());

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

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 400, 5);

            Armed = true;

            //if (TimeAlive > LifeTime * 2 / 3)
            {
                BulletExplosionDamage   = Damage / 2;
                BulletExplosionDistance = 150;

                FlamingChunkSystem.AddParticle(Position3, Rand.V3() / 1.5f, new Vector3(0, -0.25f, 0),
                                               Rand.V3(), Rand.V3() / 10, 15, 30, new Vector3(1, 0.5f, 0.2f), new Vector3(1, 0.1f, 0.2f), 0, 3);

                ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), Size.X() * 5, 4);
                for (int i = 0; i < 30; i++)
                {
                    ParticleManager.CreateParticle(Position3, Rand.V3() * 200, new Color(1, 0.75f, 0.5f), 20, 5);
                }
            }

            base.Destroy();
        }
Example #10
0
        public override void Update(GameTime gameTime)
        {
            if (AttackTarget != null)
            {
                RedFlashTime += gameTime.ElapsedGameTime.Milliseconds * 2;

                if (Vector2.Distance(AttackTarget.Position.get(), Position.get()) > (Size.X() + AttackTarget.Size.X() + 4) / 2)
                {
                    Accelerate(gameTime, AttackTarget.Position.get() - Position.get());
                }
                else
                {
                    Destroy();
                }
            }
            else
            {
                RedFlashTime += gameTime.ElapsedGameTime.Milliseconds;
            }

            if (RedFlashTime > MaxRedFlashTime)
            {
                RedFlashTime -= MaxRedFlashTime;
                RedFlashAlpha = 1;
            }
            if (RedFlashAlpha > 1)
            {
                ParticleManager.CreateParticle(new Vector3(Position.X(), Y, Position.Y()), Vector3.Zero, Color.Red * RedFlashAlpha, Size.X() * 48, 1);
                RedFlashAlpha -= gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * RedFlashChange;
            }

            base.Update(gameTime);
        }
Example #11
0
 public void ProduceParticle(Vector3 Position)
 {
     if (CanProduceParticles)
     {
         ParticleManager.CreateParticle(Position, Logic.RLerp(MinVelocity.get(), MaxVelocity.get()), new Color(Logic.RLerp(MinColor.get(), MaxColor.get())), MathHelper.Lerp(MinSize.get(), MaxSize.get(), Rand.F()), ParticleType.get());
     }
 }
Example #12
0
 public void ProduceParticle(ref Vector3 Position, ref Matrix Rotation, float Scale, float ColorMult)
 {
     if (CanProduce)
     {
         ParticleManager.CreateParticle(Position + Vector3.Transform(this.Position * Scale / 100, Rotation)
                                        , Vector3.Transform(Logic.RLerp(MinVelocity, MaxVelocity) * Scale / 100, Rotation), new Color(Logic.RLerp(MinColor, MaxColor) * ColorMult / 3), MathHelper.Lerp(MinSize, MaxSize, Rand.F()) * Scale / 100, ParticleType);
     }
 }
Example #13
0
        public override void Update(GameTime gameTime)
        {
            Interpolation += gameTime.ElapsedGameTime.Milliseconds / (4f * Math.Max(1, Vector3.Distance(To, From)));
            while (Interpolation > 1)
            {
                Interpolation -= 1;
                //LineParticleSystem.AddParticle(To, From, LineColor);
                From = To;

                if (CellX < 1 || CellY < 1 ||
                    CellX > Parent.CellsX.get() - 2 || CellY > Parent.CellsY.get() - 2 ||
                    Parent.CellGrid[CellX, CellY] == PathFindingManager.StartingCell)
                {
                    Destroy();
                    return;
                }

                for (int i = 0; i < 5; i++)
                {
                    int MaxValue = Max(Parent.CellGrid[CellX - 1, CellY], Parent.CellGrid[CellX + 1, CellY],
                                       Parent.CellGrid[CellX, CellY - 1], Parent.CellGrid[CellX, CellY + 1]);

                    if (MaxValue == Parent.CellGrid[CellX - 1, CellY])
                    {
                        CellX--;
                    }
                    if (MaxValue == Parent.CellGrid[CellX + 1, CellY])
                    {
                        CellX++;
                    }
                    if (MaxValue == Parent.CellGrid[CellX, CellY - 1])
                    {
                        CellY--;
                    }
                    if (MaxValue == Parent.CellGrid[CellX, CellY + 1])
                    {
                        CellY++;
                    }

                    if (MaxValue == PathFindingManager.DeadCell || CellX < 1 || CellY < 1 ||
                        CellX > Parent.CellsX.get() - 2 || CellY > Parent.CellsY.get() - 2)
                    {
                        Destroy();
                        return;
                    }
                }

                Vector2 Position2 = Parent.WorldPosition(CellX, CellY);
                To = new Vector3(Position2.X - 50 + Rand.F() * 100, 0, Position2.Y - 50 + Rand.F() * 100);
            }

            Vector3 InterpolatedPosition = Vector3.Lerp(From, To, Interpolation);

            ParticleManager.CreateParticle(InterpolatedPosition, Vector3.Zero, LineColor, 50, 1);
            ParticleManager.CreateParticle(InterpolatedPosition, Vector3.Zero, LineColor * 0.1f, 250, 1);

            base.Update(gameTime);
        }
        public override void Update(GameTime gameTime)
        {
            ParticleManager.CreateParticle(new Vector3(Position.X(), Y, Position.Y()), Vector3.Zero, GlowColor, Size.X() * 10, 1);

            RotationOffset += gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * 0.005f;
            WorldMatrix     = Matrix.CreateScale(Size.X()) * Matrix.CreateFromYawPitchRoll(RotationOffset, Rotation.getAsRadians() + RotationOffset / 2, RotationOffset / 4) * Matrix.CreateTranslation(new Vector3(Position.X(), Y, Position.Y()));

            base.Update(gameTime);
        }
Example #15
0
        public void Update(GameTime gameTime)
        {
            BufferReady = false;

            foreach (UnitBasic b in UnitChildren)
            {
                ParticleManager.CreateParticle(new Vector3(b.Position.X(), b.Y, b.Position.Y()), Vector3.Zero, b.GetShieldColor() * 0.5f, b.Size.X() * 12, 1);
            }
        }
 public override void PowerUp()
 {
     for (int i = 0; i < 3; i++)
     {
         ParticleManager.CreateParticle(new Vector3(Position.X(), 0, Position.Y()), Vector3.Zero, PowerUpColor, Size.X() * 2.5f, 0);
     }
     PowerUpTime = MaxPowerUpTime;
     base.PowerUp();
 }
        public override void Update(GameTime gameTime)
        {
            frame.WorldMatrix = WorldMatrix;
            if (UnitCount > 0 && !Dead && WaveFSM.WaveStepState.WeaponsFree)
            {
                UnitDelay += gameTime.ElapsedGameTime.Milliseconds;
                if (UnitDelay > MaxUnitDelay)
                {
                    UnitCount--;
                    UnitDelay -= MaxUnitDelay;

                    UnitShip s = (UnitShip)SpawnCard.GetUnit(FactionNumber);
                    ParentLevel.AddObject(s);
                    s.SetLevel((IsUpdgraded ? 3 : 2) * WaveManager.DifficultyMult, 1);

                    if (GetTeam() == WaveManager.ActiveTeam)
                    {
                        float   Theta     = 0;
                        float   Offset    = 0;
                        Vector3 Position3 = new Vector3(Position.X(), Y, Position.Y());

                        while (!TestFree(Position.get(), Theta, Offset, Size.X()))
                        {
                            Theta += (float)Math.PI / 10f;
                            if (Theta > Math.PI * 2)
                            {
                                Theta  -= (float)Math.PI * 2;
                                Offset += Size.X() / 2;
                            }
                        }

                        Vector2 BestPosition = Position.get() + Logic.ToVector2(Theta) * Offset;

                        s.Position.set(BestPosition);

                        Position3 = new Vector3(BestPosition.X, 0, BestPosition.Y);
                        for (int j = 0; j < 30; j++)
                        {
                            ParticleManager.CreateParticle(Position3, Rand.V3() * 200, new Color(1, 0.75f, 0.5f), 20, 5);
                        }

                        Position3 = new Vector3(Position.X(), 0, Position.Y());
                        ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), Size.X() * 5, 4);
                        for (int i = 0; i < 30; i++)
                        {
                            ParticleManager.CreateParticle(Position3, Rand.V3() * 200, new Color(1, 0.75f, 0.5f), 20, 5);
                        }
                    }
                    else
                    {
                        s.Position.set(NeutralManager.GetSpawnPosition());
                    }
                }
            }

            base.Update(gameTime);
        }
Example #18
0
        public virtual void Trigger(PlayerShip p)
        {
            SoundManager.PlaySound("BigBombExplode2", 1, 0, 0);
            SoundManager.DeafTone();

            p.ShakeScreen(2500);
            LinkedListNode <GameObject> CurrentNode = p.ParentScene.Children.First;

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

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

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 4000, 5);

            for (int i = 0; i < 20; i++)
            {
                FlamingChunkSystem.AddParticle(Position3, Rand.V3() * 10, new Vector3(0, -0.25f, 0),
                                               Rand.V3(), Rand.V3() / 10, 40, 30, new Vector3(1, 0.5f, 0.2f), new Vector3(1, 0.1f, 0.2f), 0, 3);
            }

            for (int i = 0; i < 50; i++)
            {
                ParticleManager.CreateParticle(Position3, Rand.V3() * 15, new Color(1, 0.75f, 0.5f), 200, 5);
            }

            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), 2000, 4);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), 3000, 4);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), 4000, 4);

            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), 500, 5);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), 1000, 5);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), 2000, 5);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), 3000, 5);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), 4000, 5);

            //ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 500, 7);
            //ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 750, 7);
            //ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 1000, 7);

            while (CurrentNode != null)
            {
                GameObject g = CurrentNode.Value;
                if (g.GetType().IsSubclassOf(typeof(UnitShip)))
                {
                    UnitShip u = (UnitShip)g;
                    u.Damage(100000, 0, Vector2.One, p, AttackType.Explosion);
                    u.Damage(100000, 0, Vector2.One, p, AttackType.Explosion);
                    WaveManager.EndWave();
                }

                CurrentNode = CurrentNode.Next;
            }
        }
        public override void Update(GameTime gameTime)
        {
            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor2, 80, 1);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor2, 100 + Rand.F() * 100, 1);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor2, 20 + Rand.F() * 40, 2);

            base.Update(gameTime);
        }
        public override void Update(GameTime gameTime)
        {
            float   Mult      = 1.5f;
            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor2, 80 * Mult, 1);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor2, (100 + Rand.F() * 100) * Mult, 1);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor2, (20 + Rand.F() * 40) * Mult, 2);

            base.Update(gameTime);
        }
 void CreateGlow(Vector2 To, Vector2 From)
 {
     ParticleManager.CreateParticle(new Vector3(From.X + (To.X - From.X) * 0.2f, 0, From.Y + (To.Y - From.Y) * 0.2f)
                                    , Vector3.Zero, WallColor, GlowSize, 1);
     ParticleManager.CreateParticle(new Vector3(From.X + (To.X - From.X) * 0.4f, 0, From.Y + (To.Y - From.Y) * 0.4f)
                                    , Vector3.Zero, WallColor, GlowSize, 1);
     ParticleManager.CreateParticle(new Vector3(From.X + (To.X - From.X) * 0.6f, 0, From.Y + (To.Y - From.Y) * 0.6f)
                                    , Vector3.Zero, WallColor, GlowSize, 1);
     ParticleManager.CreateParticle(new Vector3(From.X + (To.X - From.X) * 0.8f, 0, From.Y + (To.Y - From.Y) * 0.8f)
                                    , Vector3.Zero, WallColor, GlowSize, 1);
 }
Example #22
0
        public override void  Update(GameTime gameTime)
        {
            return;

            for (int i = 0; i < Stars.Length; i++)
            {
                ParticleManager.CreateParticle(Stars[i].Position, Vector3.Zero, Stars[i].color, Stars[i].Size, 1);
            }

            base.Update(gameTime);
        }
Example #23
0
        public override void Update(GameTime gameTime)
        {
            float   Mult      = (TimeAlive * 4 / (float)(LifeTime) + 1) * (Big ? 2 : 1);
            Vector3 Position3 = new Vector3(Position.X(), Y, Position.Y());

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor2, 60 * Mult, 1);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor2, (70 + Rand.F() * 70) * Mult, 1);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor2, (10 + Rand.F() * 20) * Mult, 0);

            base.Update(gameTime);
        }
        public override void Update(GameTime gameTime)
        {
            float   Mult      = 0.1f + TimeAlive / (float)LifeTime;
            float   Offset    = 200 * Mult;
            Vector3 Position3 = new Vector3(0, ParentUnit.Y, 0);

            float Theta       = -Logic.ToAngle(Speed) - (float)Math.PI * 1f;
            float TargetTheta = Theta + (float)(Math.PI * 1.05);
            float Alpha       = 1 - (float)LifeTime / TimeAlive;

            for (; Theta < TargetTheta; Theta += (float)Math.PI / 20)
            {
                Position3.X = Position.X() + (float)Math.Cos(Theta) * Offset;
                Position3.Z = Position.Y() + (float)Math.Sin(Theta) * Offset;
                ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor * Alpha, Offset * 4, 1);
                //ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, Offset, 0);
            }

            Position3.X = Position.X();
            Position3.Z = Position.Y();

            if (!Flashed)
            {
                Mult *= 2;
                ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 80 * Mult, 0);
                ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 80 * Mult, 4);
                Flashed = true;
            }


            QuadGrid quad = Parent2DScene.quadGrids.First.Value;

            foreach (Basic2DObject o in quad.Enumerate(Position.get(), new Vector2(Offset * 2)))
            {
                if (o.GetType().IsSubclassOf(typeof(UnitTurret)) && o != FirstHitTurret &&
                    Vector2.Distance(o.Position.get(), Position.get()) < Offset)
                {
                    UnitTurret u = (UnitTurret)o;
                    if (u.CanBeTargeted())
                    {
                        if (FirstHitTurret == null)
                        {
                            FirstHitTurret = u;
                        }
                        else
                        {
                            u.ShutDownTime = (int)(1000 * Level);
                        }
                    }
                }
            }

            base.Update(gameTime);
        }
Example #25
0
        public override void Update(GameTime gameTime)
        {
            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 80, 1);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 100 + Rand.F() * 100, 1);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 20 + Rand.F() * 40, 2);

            FlareSystem.AddLightning(Position3, ParticleColor2, 10, 20, 3, 5);
            base.Update(gameTime);
        }
        public override void Update(GameTime gameTime)
        {
            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());
            float   Mult      = 2;

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 100 * Mult, 1);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, (200 + Rand.F() * 200) * Mult, 1);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, (50 + Rand.F() * 50) * Mult, 2);
            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, (50 + Rand.F() * 50) * Mult, 0);

            base.Update(gameTime);
        }
Example #27
0
        public override void CreateChargeParticles(float A)
        {
            if (ParentUnit == null)
            {
                ParentUnit = Parent.getParent();
            }

            ParticleManager.CreateParticle(new Vector3(ParentUnit.Position.X(), ParentUnit.Y, ParentUnit.Position.Y()), Vector3.Zero,
                                           ChargeColor, ParentUnit.Size.X() * 3, 1);
            ParticleManager.CreateParticle(new Vector3(ParentUnit.Position.X(), ParentUnit.Y, ParentUnit.Position.Y()), Vector3.Zero,
                                           ChargeColor, ParentUnit.Size.X(), 0);
        }
        public override void Destroy()
        {
            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());

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

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor2, 400, 5);
            base.Destroy();
        }
Example #29
0
        public void Update(int Timer, int PreviousTimer)
        {
            if (Timer < StartTime + LifeTime)
            {
                for (int i = PreviousTimer; i < Timer - Timer % 50; i += 50)
                {
                    ParticleManager.CreateParticle(GetPosition(i), Vector3.Zero, new Color(Logic.RLerp(MinColor, MaxColor)), Size * ParticleSizeMult * (1 - (Timer - StartTime) / (float)LifeTime), ParticleType);
                }

                Vector3 NewRotation = StartingRotation + RotationSpeed / 10 * (Timer - StartTime);
                WorldMatrix = Matrix.CreateFromYawPitchRoll(NewRotation.X, NewRotation.Y, NewRotation.Z) * Matrix.CreateScale(Size / ModelSize * (1 - (Timer - StartTime) / (float)LifeTime)) * Matrix.CreateTranslation(GlowPosition = GetPosition(Timer));
            }
        }
        public override void Destroy()
        {
            Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());

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

            ParticleManager.CreateParticle(Position3, Vector3.Zero, ParticleColor, 400, 5);
            FlamingChunkSystem.AddParticle(Position3, Rand.V3() / 4, Vector3.Zero, Rand.V3(), Vector3.Zero, 20, 10, ParticleColor.ToVector3(), ParticleColor.ToVector3(), 0, 2);

            base.Destroy();
        }