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 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);
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
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 override void Update(GameTime gameTime)
        {
            ItemTime += gameTime.ElapsedGameTime.Milliseconds;
            if (ItemTime > MaxItemTime.get())
            {
                ItemTime -= MaxItemTime.get();

                CurrentItem++;
                if (CurrentItem > ModelCount.get() - 1)
                {
                    CurrentItem = 0;
                }
            }
            if (Items[CurrentItem] == null)
            {
                Items[CurrentItem] = new LineModelItem(Models[CurrentItem].get(), LineFlares.get(), RandomFlares.get());
            }
            Items[CurrentItem].Update(gameTime);

            WorldCameraInterpolation += gameTime.ElapsedGameTime.Milliseconds * 60 / 100000f * CameraSpeed.get();

            if (WorldCameraInterpolation > 1)
            {
                WorldCameraInterpolation = 0;
                WorldCameraFrom          = Rand.V3() * Items[CurrentItem].Distance * 3;
                WorldCameraTo            = Rand.V3() * Items[CurrentItem].Distance * 3;
                WorldCameraLookAt        = Items[CurrentItem].Points[Rand.r.Next(Items[CurrentItem].Points.Count)] / 2;
            }

            MyCamera.SetLookAt(Vector3.Lerp(WorldCameraFrom, WorldCameraTo, WorldCameraInterpolation), WorldCameraLookAt);

            base.Update(gameTime);
        }
Exemplo n.º 6
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 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();
        }
        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 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);
        }
Exemplo n.º 10
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 WorldFlare(float Distance, Vector3 SpawnPosition, Color color, float Speed)
        {
            this.color         = color;
            this.SpawnPosition = SpawnPosition;
            this.From          = SpawnPosition;
            this.To            = Rand.V3() * Distance + SpawnPosition;
            this.Interpolation = Rand.F();

            this.Speed    = Speed;
            this.Distance = Distance;
        }
 public Vector3 getRandomPosition()
 {
     if (!Sphere.get())
     {
         return(Position.get() + Vector3.Transform(Rand.V3() / 2, ScaleMatrix));
     }
     else
     {
         return(Position.get() + Vector3.Transform(Rand.VECTV3() / 2, ScaleMatrix));
     }
 }
        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();
        }
Exemplo n.º 14
0
        public override void Destroy()
        {
            SoundManager.PlaySound("SmallBombExplode", 1, 0, 0);
            SoundManager.DeafTone();
            PlayerShip ParentPlayer = (PlayerShip)ParentUnit;

            ParentPlayer.ShakeScreen(20);

            this.Armed = false;

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

            for (int i = 0; i < 10; i++)
            {
                ParticleManager.CreateParticle(Position3, Rand.V3() * 6, 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 < 10; i++)
            {
                FlamingChunkSystem.AddParticle(Position3, Rand.V3(), new Vector3(0, -0.25f, 0),
                                               Rand.V3(), Rand.V3() / 10, 20, 60, 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), 500, 4);
            for (int i = 0; i < 30; i++)
            {
                ParticleManager.CreateParticle(Position3, Rand.V3() * 10, new Color(1, 0.75f, 0.5f), 200, 5);
            }

            QuadGrid quadGrid = Parent2DScene.quadGrids.First.Value;

            foreach (GameObject g in quadGrid.Enumerate(Position.get(), new Vector2(BulletExplosionDistance)))
            {
                if (g.GetType().IsSubclassOf(typeof(UnitBasic)))
                {
                    UnitBasic s = (UnitBasic)g;
                    if (Vector2.Distance(Position.get(), s.Position.get()) < BulletExplosionDistance / 4 && !s.IsAlly(ParentUnit) && !s.GetType().IsSubclassOf(typeof(UnitBuilding)))
                    {
                        s.SmallBomb(ParentUnit);
                    }
                }
            }

            base.Destroy();
        }
        private void SummonUnits()
        {
            if (!CanSummon)
            {
                return;
            }

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

            CanSummon   = false;
            HasSummoned = true;

            float Theta  = 0;
            float Offset = Size.X() * 2;

            for (int i = 0; i < SummonCard.GhostCount; i++)
            {
                UnitShip u = (UnitShip)SummonCard.GetUnit(FactionNumber);
                ParentLevel.AddObject(u);

                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();
                    }
                }
                Vector2 BestPosition = Logic.ToVector2(Theta) * Offset + Position.get();

                u.SetForGhost();
                u.SetLevel(UnitLevel, 1);
                u.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);
            }
        }
        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();
        }
        public override void Update(GameTime gameTime)
        {
            Interpolation += gameTime.ElapsedGameTime.Milliseconds / (Math.Max(1, Vector3.Distance(To, From))) * Speed;
            while (Interpolation > 1)
            {
                Interpolation -= 1;
                From           = To;
                To             = Rand.V3() * Distance + SpawnPosition;
            }

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

            ParticleManager.CreateParticle(InterpolatedPosition, Vector3.Zero, color * 0.4f, 75, 1);
        }
Exemplo n.º 18
0
        public static void AddLightning(Vector3 position, Color color, float Size,
                                        float Spread, int Lines, int LinePop)
        {
            for (int i = 0; i < Lines; i++)
            {
                Vector3 PreviousPosition = position;
                position += Rand.V3() * Spread;

                for (int j = 0; j < LinePop; j++)
                {
                    self.AddParticle(PreviousPosition + (position - PreviousPosition) * (j / (float)LinePop), Vector3.Zero, color, Size);
                }
            }
        }
Exemplo n.º 19
0
        private void Activate()
        {
            if (!WaveStepState.WeaponsFree)
            {
                return;
            }

            FactionManager.AddEnergy(ParentShip.FactionNumber, -150);

            Vector3 Position3 = new Vector3(ParentShip.Position.X(), 0, ParentShip.Position.Y());
            float   Theta     = 0;
            float   Offset    = ParentShip.Size.X() * 2;

            FactionManager.Factions[ParentShip.FactionNumber].roundReport.UnitsSpawned += MyCard.GhostCount;

            for (int i = 0; i < MyCard.GhostCount; i++)
            {
                UnitShip u = (UnitShip)MyCard.GetUnit(ParentShip.FactionNumber);
                ParentShip.ParentLevel.AddObject(u);

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

                u.SetForGhost();
                u.Position.set(BestPosition);
                u.SetLevel(WaveManager.CurrentWave / 5f * WaveCard.LevelMult, 1);

                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);
                }
            }


            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), ParentShip.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);
            }
        }
        public void Update(GameTime gameTime)
        {
            Interpolation += gameTime.ElapsedGameTime.Milliseconds / (20f * Math.Max(1, Vector3.Distance(To, From)));
            while (Interpolation > 1)
            {
                Interpolation -= 1;
                LineParticleSystem.AddParticle(To, From, Color.White);
                From = To;
                To   = Rand.V3() * ScaleSize / 25f;
            }

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

            ParticleManager.CreateParticle(InterpolatedPosition, Vector3.Zero, Color.White, ScaleSize * 0.001f, 1);
        }
        public override void Destroy()
        {
            this.Armed = false;

            Vector3 Position3 = new Vector3(Position.X(), 0, 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), 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);
            }

            QuadGrid quadGrid = Parent2DScene.quadGrids.First.Value;

            float MaxDist = 150 * Level;

            foreach (GameObject g in quadGrid.Enumerate(Position.get(), new Vector2(MaxDist * 2)))
            {
                if (g.GetType().IsSubclassOf(typeof(UnitBasic)))
                {
                    UnitBasic s = (UnitBasic)g;
                    if (Vector2.Distance(Position.get(), s.Position.get()) < MaxDist && !s.IsAlly(ParentUnit))
                    {
                        s.ShutDownTime = Math.Max(s.ShutDownTime, (int)(2000 * Level));
                    }
                }
            }

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

            for (int i = 0; i < 4; i++)
            {
                FlamingChunkSystem.AddParticle(Position3, Rand.V3() * Size.X() / 60, new Vector3(0, -0.25f, 0),
                                               Rand.V3(), Rand.V3() / 10, 0.375f * Size.X(), 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() * Size.X(), new Color(1, 0.75f, 0.5f), Size.X() / 2, 5);
            }
            ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), Size.X() * 2, 5);
        }
        public override void Update(GameTime gameTime)
        {
            WorldCameraInterpolation += gameTime.ElapsedGameTime.Milliseconds * 60 / 100000f * CameraSpeed.get();

            if (WorldCameraInterpolation > 1)
            {
                WorldCameraInterpolation = 0;
                WorldCameraFrom          = Rand.V3() * CameraDistance.get();
                WorldCameraTo            = Rand.V3() * CameraDistance.get();
            }

            //WorldCameraLookAt = MyPoint.DrawPosition;
            MyCamera.SetLookAt(Vector3.Lerp(WorldCameraFrom, WorldCameraTo, WorldCameraInterpolation), WorldCameraLookAt);
            //MyCamera.SetLookAt(new Vector3(10,100,10), new Vector3(0,0,0));
            MyPoint.Update(gameTime);

            base.Update(gameTime);
        }
Exemplo n.º 24
0
        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);
            }


            float MaxDist = 600;

            foreach (GameObject g in p.Parent2DScene.quadGrids.First.Value.Enumerate(p.Position.get(), new Vector2(MaxDist * 2)))
            {
                if (g.GetType().IsSubclassOf(typeof(UnitShip)))
                {
                    UnitShip s = (UnitShip)g;
                    if (Vector2.Distance(p.Position.get(), s.Position.get()) < MaxDist && s.IsAlly(p))
                    {
                        s.InvTime = Math.Max(s.InvTime, (int)(10000));
                    }
                }
            }

            return(true);
        }
        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();
        }
        public override void Interact(PlayerShip p)
        {
            if (miningPlatform == null && FactionManager.CanBuildMiningPlatform(p.FactionNumber))
            {
                Vector3 P3 = new Vector3(Position.X(), 0, Position.Y());
                for (int i = 0; i < 40; i++)
                {
                    LineParticleSystem.AddParticle(P3, P3 + Rand.V3() * 1000, TeamInfo.GetColor(p.GetTeam()));
                }

                MiningPlatform m = FactionManager.GetMiningPlatform(p.FactionNumber);
                ParentLevel.AddObject(m);
                m.Position.set(Position.get());
                setPlatform(m);

                SoundManager.Play3DSound("PlayerBuildMiningRing",
                                         new Vector3(m.Position.X(), Y, m.Position.Y()), 0.25f, 500, 1);

                if (p.PlacedStartingMineralRock)
                {
                    FactionManager.AddCells(p.FactionNumber, -FactionManager.GetMiningPlatformCost(p.FactionNumber));
                    FactionManager.SetBuildingPlatform(p.FactionNumber, m);
                }
                else
                {
                    FactionManager.GetFaction(p.FactionNumber).MiningPlatformCounter = 0;
                    m.HullToughness *= 2;
                    m.SetAsStarting();
                    p.PlacedStartingMineralRock = true;
                    p.StartingMineralRock       = this;
                }

                p.LastPlacedPlatform.AddFirst(m);
                PathFindingManager.AddMineralRock(m);
            }
            base.Interact(p);
        }
Exemplo n.º 28
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);
        }
Exemplo n.º 30
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);
        }