예제 #1
0
        public override void Destroy()
        {
            SoundManager.Play3DSound("MineImpact",
                                     new Vector3(Position.X(), Y, Position.Y()), 0.25f, 800, 2f);

            QuadGrid grid = Parent2DScene.quadGrids.First.Value;
            float    BulletExplosionDistance = 200;

            for (int i = 0; i < 2; i++)
            {
                foreach (Basic2DObject o in grid.Enumerate(Position.get(), new Vector2(BulletExplosionDistance)))
                {
                    if (o.GetType().IsSubclassOf(typeof(BasicShipGameObject)))
                    {
                        BasicShipGameObject s = (BasicShipGameObject)o;
                        float dist            = Vector2.Distance(s.Position.get(), Position.get()) - o.Size.X() / 2;

                        if (dist < BulletExplosionDistance && GetTeam() != s.GetTeam())
                        {
                            float DistMult = 1;
                            if (dist > 0)
                            {
                                DistMult = (BulletExplosionDistance - dist) / BulletExplosionDistance;
                            }
                            s.Damage(DistMult * 4, DistMult, Vector2.Normalize(s.Position.get() - Position.get()) * 1 * DistMult, this, AttackType.Green);
                        }
                    }
                }
            }

            base.Destroy();
        }
예제 #2
0
        public virtual void Collide(BasicShipGameObject s)
        {
            if (!s.IsAlly(ParentUnit))
            {
                if (!BulletCanBounce || !s.BulletBounces(this))
                {
                    float Damage = getDamage(s, 1);
                    Damage *= ParentUnit.GetDamageMult();
                    s.Damage(Damage, PushTime * Damage, Speed * PushVelocityMult, ParentUnit, attackType);
                }
                else
                {
                    BulletHasBounced = true;

                    if (!BounceSound)
                    {
                        SoundManager.Play3DSound("ShieldBounce", new Vector3(Position.X(), Y, Position.Y()),
                                                 0.35f, 500, 1);
                        BounceSound = true;
                    }

                    if (s.GetType().IsSubclassOf(typeof(UnitBasic)))
                    {
                        UnitBasic b = (UnitBasic)s;
                        b.ShieldFlash(1);
                    }
                    Speed = Vector2.Reflect(Speed, Vector2.Normalize(s.Position.get() - PreviousPosition));
                    Position.set(PreviousPosition);
                    return;
                }
            }

            if (TargetHitCount < MaxHits)
            {
                if (TargetsHit == null)
                {
                    TargetsHit = new BasicShipGameObject[MaxHits];
                    TargetsHit[TargetHitCount++] = s;
                }
                else if (!TargetsHit.Contains(s))
                {
                    TargetsHit[TargetHitCount++] = s;
                }
                else
                {
                    return;
                }
            }
            else
            {
                Destroy();
            }
        }
예제 #3
0
        public override void Collide(GameTime gameTime, BasicShipGameObject Other)
        {
            if (Other != null && Other.GetType().Equals(typeof(PlayerShip)) && Other.GetTeam() == WaveManager.ActiveTeam && Other.CanBeTargeted())
            {
                for (int i = 0; i < 2; i++)
                {
                    Damage(100, 100, Vector2.Zero, Other, AttackType.Melee);
                    Other.Damage(100, 100, Vector2.Zero, this, AttackType.Melee);
                }
            }

            base.Collide(gameTime, Other);
        }
예제 #4
0
        public override void Collide(GameTime gameTime, BasicShipGameObject Other)
        {
            if (Other != null && !Other.Dead && Other.GetType().IsSubclassOf(typeof(UnitTurret)) && Other.GetTeam() == WaveManager.ActiveTeam)
            {
                for (int i = 0; i < 2; i++)
                {
                    Damage(1000, 0, Vector2.Zero, Other, AttackType.Explosion);
                    Other.Damage(1000, 0, Vector2.Zero, this, AttackType.Explosion);
                }
            }

            base.Collide(gameTime, Other);
        }
예제 #5
0
 public override void Collide(GameTime gameTime, BasicShipGameObject Other)
 {
     if (Other == null)
     {
         return;
     }
     if (Other.GetTeam() != GetTeam() && Other.CanBeTargeted())
     {
         for (int i = 0; i < 2; i++)
         {
             Other.Damage(2, 10, Speed, this, AttackType.Green);
         }
         Destroy();
     }
     return;
 }
        public override void Update(GameTime gameTime)
        {
            Vector2 StartPosition = Position.get();
            Vector2 EndPosition   = Position.get() + Vector2.Normalize(Speed) * 600;

            ParticleManager.CreateParticle(new Vector3(StartPosition.X, 0, StartPosition.Y), Vector3.Zero, ParticleColor, 300, 5);
            ParticleManager.CreateParticle(new Vector3(StartPosition.X, 0, StartPosition.Y), Vector3.Zero, ParticleColor, 300, 7);
            ParticleManager.CreateParticle(new Vector3(StartPosition.X, 0, StartPosition.Y), Vector3.Zero, ParticleColor, 300, 4);

            for (int i = 0; i < 100; i++)
            {
                ParticleManager.CreateParticle(
                    new Vector3(StartPosition.X, 0, StartPosition.Y) + (new Vector3(EndPosition.X - StartPosition.X, 0, EndPosition.Y - StartPosition.Y) * i / 100),
                    Vector3.Zero, ParticleColor, 150, 5);
            }

            ParticleManager.CreateParticle(new Vector3(EndPosition.X, 0, EndPosition.Y), Vector3.Zero, ParticleColor, 300, 5);
            ParticleManager.CreateParticle(new Vector3(EndPosition.X, 0, EndPosition.Y), Vector3.Zero, ParticleColor, 300, 7);
            ParticleManager.CreateParticle(new Vector3(EndPosition.X, 0, EndPosition.Y), Vector3.Zero, ParticleColor, 300, 4);

            QuadGrid quadGrid = Parent2DScene.quadGrids.First.Value;

            Vector2 UpperLeftCorner  = Logic.Min(StartPosition, EndPosition) - new Vector2(200);
            Vector2 LowerRightCorner = Logic.Max(StartPosition, EndPosition) + new Vector2(200);

            QuadGridXMin = (int)((UpperLeftCorner.X - quadGrid.Min.X) / quadGrid.CellSize.X);
            QuadGridXMax = (int)((LowerRightCorner.X - quadGrid.Min.X) / quadGrid.CellSize.X);
            QuadGridYMin = (int)((UpperLeftCorner.Y - quadGrid.Min.Y) / quadGrid.CellSize.Y);
            QuadGridYMax = (int)((LowerRightCorner.Y - quadGrid.Min.Y) / quadGrid.CellSize.Y);

            foreach (Basic2DObject g in quadGrid.Enumerate(QuadGridXMin, QuadGridYMin, QuadGridXMax, QuadGridYMax))
            {
                if (g.GetType().IsSubclassOf(typeof(BasicShipGameObject)))
                {
                    BasicShipGameObject s = (BasicShipGameObject)g;
                    if (!s.IsAlly(ParentUnit) && CheckCircle(s, StartPosition, EndPosition, AttackLineWidth))
                    {
                        s = s.ReturnCollision();
                        s.Damage(Damage, 1, EndPosition - StartPosition, ParentUnit, AttackType.Red);
                    }
                }
            }

            Destroy();
        }
예제 #7
0
        public override void Destroy()
        {
            if (ShouldDodge && DodgeBullets.Contains(this))
            {
                DodgeBullets.Remove(this);
            }

            if (Commited && !NoInstanceCommit)
            {
                Commited = false;
                BulletInstancer.RemoveChild(this);
            }

            Destroyed = true;
            if (Armed && BulletExplosionDamage > 0 && BulletExplosionDistance > 0)
            {
                QuadGrid grid = Parent2DScene.quadGrids.First.Value;

                foreach (Basic2DObject o in grid.Enumerate(Position.get(), new Vector2(BulletExplosionDistance)))
                {
                    if (o.GetType().IsSubclassOf(typeof(BasicShipGameObject)))
                    {
                        BasicShipGameObject s = (BasicShipGameObject)o;
                        float dist            = Vector2.Distance(s.Position.get(), Position.get()) - o.Size.X() / 2;

                        if (dist < BulletExplosionDistance && !ParentUnit.IsAlly(s))
                        {
                            float DistMult = 1;
                            if (dist > 0)
                            {
                                DistMult = (BulletExplosionDistance - dist) / BulletExplosionDistance;
                            }
                            s.Damage(DistMult * BulletExplosionDamage, DistMult * PushTime, Vector2.Normalize(s.Position.get() - Position.get()) * PushVelocityMult * DistMult, ParentUnit, attackType);
                        }
                    }
                }
            }

            SoundManager.Play3DSound(ImpactString, new Vector3(Position.X(), Y, Position.Y()),
                                     ImpactVolume, ImpactDistance, ImpactExponent);

            base.Destroy();
        }
예제 #8
0
        public override void Update(GameTime gameTime)
        {
            float dist = BeamTurretCard.EngagementDistance;

            Vector2 StartPosition = Position.get();
            Vector2 EndPosition   = Position.get() + Vector2.Normalize(Speed) * dist;

            ParticleManager.CreateParticle(new Vector3(StartPosition.X, 0, StartPosition.Y), Vector3.Zero, ParticleColor, 300, 5);
            ParticleManager.CreateParticle(new Vector3(StartPosition.X, 0, StartPosition.Y), Vector3.Zero, ParticleColor, 300, 4);
            for (int i = 0; i < 75; i++)
            {
                ParticleManager.CreateParticle(
                    new Vector3(StartPosition.X, 0, StartPosition.Y) + (new Vector3(EndPosition.X - StartPosition.X, 0, EndPosition.Y - StartPosition.Y) * i / 75),
                    Vector3.Zero, ParticleColor, 100, 5);
            }

            ParticleManager.CreateParticle(new Vector3(EndPosition.X, 0, EndPosition.Y), Vector3.Zero, ParticleColor, 300, 5);
            ParticleManager.CreateParticle(new Vector3(EndPosition.X, 0, EndPosition.Y), Vector3.Zero, ParticleColor, 300, 4);

            QuadGrid quadGrid = Parent2DScene.quadGrids.First.Value;

            Vector2 UpperLeftCorner  = Logic.Min(StartPosition, EndPosition) - new Vector2(200);
            Vector2 LowerRightCorner = Logic.Max(StartPosition, EndPosition) + new Vector2(200);

            QuadGridXMin = (int)((UpperLeftCorner.X - quadGrid.Min.X) / quadGrid.CellSize.X);
            QuadGridXMax = (int)((LowerRightCorner.X - quadGrid.Min.X) / quadGrid.CellSize.X);
            QuadGridYMin = (int)((UpperLeftCorner.Y - quadGrid.Min.Y) / quadGrid.CellSize.Y);
            QuadGridYMax = (int)((LowerRightCorner.Y - quadGrid.Min.Y) / quadGrid.CellSize.Y);

            if (QuadGridXMax > quadGrid.CellsX - 1)
            {
                QuadGridXMax = quadGrid.CellsX - 1;
            }
            if (QuadGridXMin > quadGrid.CellsX - 1)
            {
                QuadGridXMin = quadGrid.CellsX - 1;
            }
            if (QuadGridYMax > quadGrid.CellsY - 1)
            {
                QuadGridYMax = quadGrid.CellsY - 1;
            }
            if (QuadGridYMin > quadGrid.CellsY - 1)
            {
                QuadGridYMin = quadGrid.CellsY - 1;
            }
            if (QuadGridXMax < 0)
            {
                QuadGridXMax = 0;
            }
            if (QuadGridXMin < 0)
            {
                QuadGridXMin = 0;
            }
            if (QuadGridYMax < 0)
            {
                QuadGridYMax = 0;
            }
            if (QuadGridYMin < 0)
            {
                QuadGridYMin = 0;
            }

            foreach (Basic2DObject g in quadGrid.Enumerate(QuadGridXMin, QuadGridYMin, QuadGridXMax, QuadGridYMax))
            {
                if (g.GetType().IsSubclassOf(typeof(BasicShipGameObject)))
                {
                    BasicShipGameObject s = (BasicShipGameObject)g;
                    if (!s.IsAlly(ParentUnit) && CheckCircle(s, StartPosition, EndPosition, AttackLineWidth))
                    {
                        s = s.ReturnCollision();
                        if (s != null)
                        {
                            s.Damage(Damage, 4, EndPosition - StartPosition, ParentUnit, AttackType.Green);
                        }
                    }
                }
            }

            Destroy();
        }
예제 #9
0
        public void FireShot(Vector2 StartPosition, Vector2 EndPosition, float LineWidth)
        {
            SoundManager.Play3DSound("SiegeLaserFire", new Vector3(Position.X(), Y, Position.Y()), 0.75f, 1000, 1.5f);

            ParticleManager.CreateParticle(new Vector3(StartPosition.X, 0, StartPosition.Y), Vector3.Zero, LaserColor, 300, 5);
            ParticleManager.CreateParticle(new Vector3(StartPosition.X, 0, StartPosition.Y), Vector3.Zero, LaserColor, 300, 7);
            ParticleManager.CreateParticle(new Vector3(StartPosition.X, 0, StartPosition.Y), Vector3.Zero, LaserColor, 300, 4);

            int c = (int)Vector2.Distance(StartPosition, EndPosition) / 10;

            for (int i = 0; i < c; i++)
            {
                ParticleManager.CreateParticle(
                    new Vector3(StartPosition.X, 0, StartPosition.Y) + (new Vector3(EndPosition.X - StartPosition.X, 0, EndPosition.Y - StartPosition.Y) * i / c),
                    Vector3.Zero, LaserColor, 100, 5);
            }

            ParticleManager.CreateParticle(new Vector3(EndPosition.X, 0, EndPosition.Y), Vector3.Zero, LaserColor, 300, 5);
            ParticleManager.CreateParticle(new Vector3(EndPosition.X, 0, EndPosition.Y), Vector3.Zero, LaserColor, 300, 7);
            ParticleManager.CreateParticle(new Vector3(EndPosition.X, 0, EndPosition.Y), Vector3.Zero, LaserColor, 300, 4);

            QuadGrid quadGrid = Parent2DScene.quadGrids.First.Value;

            Vector2 UpperLeftCorner  = Logic.Min(StartPosition, EndPosition) - new Vector2(200);
            Vector2 LowerRightCorner = Logic.Max(StartPosition, EndPosition) + new Vector2(200);

            QuadGridXMin = (int)((UpperLeftCorner.X - quadGrid.Min.X) / quadGrid.CellSize.X);
            QuadGridXMax = (int)((LowerRightCorner.X - quadGrid.Min.X) / quadGrid.CellSize.X);
            QuadGridYMin = (int)((UpperLeftCorner.Y - quadGrid.Min.Y) / quadGrid.CellSize.Y);
            QuadGridYMax = (int)((LowerRightCorner.Y - quadGrid.Min.Y) / quadGrid.CellSize.Y);

            if (QuadGridXMax > quadGrid.CellsX - 1)
            {
                QuadGridXMax = quadGrid.CellsX - 1;
            }
            if (QuadGridXMin > quadGrid.CellsX - 1)
            {
                QuadGridXMin = quadGrid.CellsX - 1;
            }
            if (QuadGridYMax > quadGrid.CellsY - 1)
            {
                QuadGridYMax = quadGrid.CellsY - 1;
            }
            if (QuadGridYMin > quadGrid.CellsY - 1)
            {
                QuadGridYMin = quadGrid.CellsY - 1;
            }
            if (QuadGridXMax < 0)
            {
                QuadGridXMax = 0;
            }
            if (QuadGridXMin < 0)
            {
                QuadGridXMin = 0;
            }
            if (QuadGridYMax < 0)
            {
                QuadGridYMax = 0;
            }
            if (QuadGridYMin < 0)
            {
                QuadGridYMin = 0;
            }

            foreach (Basic2DObject g in quadGrid.Enumerate(QuadGridXMin, QuadGridYMin, QuadGridXMax, QuadGridYMax))
            {
                if (g.GetType().IsSubclassOf(typeof(BasicShipGameObject)))
                {
                    BasicShipGameObject s = (BasicShipGameObject)g;
                    if (!s.IsAlly(this) && CheckCircle(s, StartPosition, EndPosition, LineWidth))
                    {
                        s = s.ReturnCollision();
                        s.Damage(LaserDamage * GetDamageMult(), 1, EndPosition - StartPosition, this, AttackType.Red);
                    }
                }
            }
        }
예제 #10
0
        public override void BlowUp()
        {
            if (!Dead)
            {
                for (int i = 0; i < 36; i++)
                {
                    Guns[0].FireModes[0].Fire((float)Math.PI * (float)i / 18);
                }

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

                ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), Size.X() * 10, 4);
                ParticleManager.CreateParticle(Position3, Vector3.Zero, new Color(1, 0.75f, 0.5f), Size.X() * 6, 6);

                float    BulletExplosionDistance = IsUpdgraded ? 300 : 500;
                float    BulletExplosionDamage   = IsUpdgraded ? 0.5f : 1f;
                QuadGrid grid = Parent2DScene.quadGrids.First.Value;

                for (int i = 0; i < 2; i++)
                {
                    bool ActivateDeathSound = true;
                    foreach (Basic2DObject o in grid.Enumerate(Position.get(), new Vector2(BulletExplosionDistance * 2)))
                    {
                        if (o.GetType().IsSubclassOf(typeof(UnitShip)))
                        {
                            BasicShipGameObject s = (BasicShipGameObject)o;
                            float dist            = Vector2.Distance(s.Position.get(), Position.get()) - o.Size.X() / 2;

                            if (dist < BulletExplosionDistance && GetTeam() != s.GetTeam())
                            {
                                float DistMult = 1;
                                if (dist > 0)
                                {
                                    DistMult = (BulletExplosionDistance - dist) / BulletExplosionDistance;
                                }

                                if (s.GetType().IsSubclassOf(typeof(UnitShip)))
                                {
                                    UnitShip ship = (UnitShip)s;
                                    ship.CanDeathSound = ActivateDeathSound;
                                }
                                s.Damage(DistMult * BulletExplosionDamage, DistMult,
                                         Vector2.Normalize(s.Position.get() - Position.get()), this, AttackType.Explosion);

                                if (s.Dead)
                                {
                                    ActivateDeathSound = false;
                                }
                                else if (s.GetType().IsSubclassOf(typeof(UnitShip)))
                                {
                                    UnitShip ship = (UnitShip)s;
                                    ship.CanDeathSound = true;
                                }
                            }
                        }
                    }
                }
            }

            base.BlowUp();
        }
        public override void BlowUp()
        {
            if (Dead || Lives < 1)
            {
                return;
            }

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

            for (int i = 0; i < 10; i++)
            {
                LineParticleSystem.AddParticle(P3, P3 + Rand.V3() * MaxEngagementDistance, TeamInfo.GetColor(GetTeam()));
            }

            foreach (Faction f in FactionManager.Factions)
            {
                if (MyCard == null)
                {
                    MyCard = (TurretCard)FactionCard.FactionTurretDeck[0];
                }

                if (f.Team != GetTeam())
                {
                    f.roundReport.TurretsKilled++;
                    f.AddEvent(MyCard.Name + " Destroyed", new Color(1, 0.5f, 0.5f), FactionEvent.KillTexture);
                }
                else
                {
                    f.roundReport.TurretsLost++;
                    f.AddEvent(MyCard.Name + " Lost", new Color(1, 0.5f, 0.5f), FactionEvent.LossTexture);
                }
            }

            if (ShouldDeathSound)
            {
                SoundManager.Play3DSound(DeathSound, new Vector3(Position.X(), Y, Position.Y()), DeathVolume, 1000, 1);
                ShouldDeathSound = false;
            }


            FreezeMult = 0;
            VirusTime  = 0;
            DeathParticles();
            Lives--;

            Dead = true;
            if (MyBustedTurret == null)
            {
                MyBustedTurret = new BustedTurret(this);
                ParentLevel.AddObject(MyBustedTurret);
                MyBustedTurret.SetPosition(getPosition());
            }

            MyBustedTurret.WorldMatrix = WorldMatrix;
            MyBustedTurret.Activate();
            InstanceManager.RemoveChild(this);
            RemoveTag(GameObjectTag._2DSolid);
            RemoveTag(GameObjectTag._2DForward);

            LinkedList <GameObject> GList = Parent2DScene.GetList(GameObjectTag._2DSolid);

            if (GList.Contains(this))
            {
                GList.Remove(this);
            }

            BuildTimer = 0;

            float    BulletExplosionDistance = 200;
            float    BulletExplosionDamage   = 1f;
            QuadGrid grid = Parent2DScene.quadGrids.First.Value;


            for (int i = 0; i < 2; i++)
            {
                bool ActivateDeathSound = true;

                foreach (Basic2DObject o in grid.Enumerate(Position.get(), new Vector2(BulletExplosionDistance * 2)))
                {
                    if (o.GetType().IsSubclassOf(typeof(UnitShip)))
                    {
                        BasicShipGameObject s = (BasicShipGameObject)o;
                        float dist            = Vector2.Distance(s.Position.get(), Position.get()) - o.Size.X() / 2;

                        if (dist < BulletExplosionDistance && GetTeam() != s.GetTeam() && s.CanBeTargeted())
                        {
                            float DistMult = 1;
                            if (dist > 0)
                            {
                                DistMult = (BulletExplosionDistance - dist) / BulletExplosionDistance;
                            }

                            if (s.GetType().IsSubclassOf(typeof(UnitShip)))
                            {
                                UnitShip ship = (UnitShip)s;
                                ship.CanDeathSound = ActivateDeathSound;
                            }
                            s.Damage(DistMult * BulletExplosionDamage, DistMult, Vector2.Normalize(s.Position.get() - Position.get()), this, AttackType.Explosion);

                            if (s.Dead)
                            {
                                ActivateDeathSound = false;
                            }
                            else if (s.GetType().IsSubclassOf(typeof(UnitShip)))
                            {
                                UnitShip ship = (UnitShip)s;
                                ship.CanDeathSound = true;
                            }
                        }
                    }
                }
            }

            if (ShieldAlpha > 0)
            {
                ShieldInstancer.Remove(this);
                ShieldAlpha = -1;
            }
        }
        public virtual void Collide(GameTime gameTime, BasicShipGameObject Other)
        {
            if (Other == null)
            {
                return;
            }

            if (!Dead && !Other.Dead && !Other.IsAlly(this) && FreezeTime < 0 && Other.GetType().IsSubclassOf(typeof(UnitBasic)))
            {
                UnitBasic u = (UnitBasic)Other;
                if (u.FreezeTime < 0)
                {
                    Vector3 Position3 = new Vector3((Position.X() + Other.Position.X()) / 2, Y, (Position.Y() + Other.Position.Y()) / 2);
                    if (CollisionSound.Equals("") && u.CollisionSound.Equals(""))
                    {
                        SoundManager.Play3DSound("CollisionImpact", Position3, 0.5f, 300, 2);
                    }
                    else
                    {
                        SoundManager.Play3DSound(CollisionSound.Equals("") ? u.CollisionSound : CollisionSound,
                                                 Position3, 0.5f, 300, 2);
                    }


                    Damage(Other.fieldState != FieldState.SpeedBoost || Other.FieldStateTime < 1 ? Other.CollisionDamage : Other.CollisionDamage * 1.25f
                           , 5, Position.get() - Other.Position.get(), Other, AttackType.Melee);

                    Other.Damage(fieldState != FieldState.SpeedBoost || FieldStateTime < 1 ? CollisionDamage : CollisionDamage * 1.25f
                                 , 5, Other.Position.get() - Position.get(), this, AttackType.Melee);

                    if (!GetType().IsSubclassOf(typeof(UnitBuilding)))
                    {
                        FreezeTime = Math.Max(FreezeTime, Other.CollisionFreezeTime);
                        StunState  = AttackType.Melee;
                    }
                    if (!u.GetType().IsSubclassOf(typeof(UnitBuilding)))
                    {
                        u.FreezeTime = Math.Max(u.FreezeTime, CollisionFreezeTime);
                        u.StunState  = AttackType.Melee;
                    }
                }
            }

            float MoveAmount = (Size.X() + Other.getSize().X) / 2 - Vector2.Distance(Other.Position.get(), Position.get());

            if (Other.Moveable)
            {
                CollisionIteration++;
                if (CollisionIteration > 10000)
                {
                    CollisionIteration = 0;
                }

                UnitBasic u = (UnitBasic)Other;
                if (Vector2.Distance(u.Position.get(), Position.get()) > 0.1f)
                {
                    u.Push(u.Position.get() + Vector2.Normalize(Other.Position.get() - Position.get()) * MoveAmount / 2, 0);
                    Push(Position.get() + Vector2.Normalize(Position.get() - Other.Position.get()) * MoveAmount / 2, 0);
                }
                else
                {
                    u.Push(u.Position.get() + Vector2.One * MoveAmount, 0);
                    Push(Position.get() - Vector2.One * MoveAmount, 0);
                }
            }
            else
            {
                if (Vector2.Distance(Other.Position.get(), Position.get()) > 0.1f)
                {
                    Push(Position.get() + Vector2.Normalize(Position.get() - Other.Position.get()) * MoveAmount, MoveAmount);
                }
                else
                {
                    Push(Position.get() + Vector2.One * MoveAmount * 2, MoveAmount * 2);
                }
            }
        }
        private void DoExplosion()
        {
            if (!Dead)
            {
                BulletExplosionDistance = 300 * (1 + (MaxBombs - Bombs) / MaxBombs) / WaveCard.LevelMult;
                BulletExplosionDamage   = 1f / WaveCard.LevelMult;

                Vector3 Position3 = new Vector3(Position.X(), 0, Position.Y());
                for (int i = 0; i < 10; i++)
                {
                    ParticleManager.CreateParticle(Position3, Rand.V3() * 6, ParticleColor, 20 / WaveCard.LevelMult, 5);
                }

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

                for (int i = 0; i < 10; i++)
                {
                    FlamingChunkSystem.AddParticle(Position3, Rand.V3() / WaveCard.LevelMult, new Vector3(0, -0.25f, 0),
                                                   Rand.V3(), Rand.V3() / 10, 20 / WaveCard.LevelMult, 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 / WaveCard.LevelMult, 4);
                for (int i = 0; i < 30; i++)
                {
                    ParticleManager.CreateParticle(Position3, Rand.V3() * 10, new Color(1, 0.75f, 0.5f), 200 / WaveCard.LevelMult, 5);
                }
            }
            else
            {
                foreach (PlayerShip p in ParentScene.Enumerate(typeof(PlayerShip)))
                {
                    p.ShakeScreen(250);
                }

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

                BulletExplosionDistance = 1200 / WaveCard.LevelMult;
                BulletExplosionDamage   = 5f / WaveCard.LevelMult;
            }

            QuadGrid grid = Parent2DScene.quadGrids.First.Value;

            for (int i = 0; i < 2; i++)
            {
                foreach (Basic2DObject o in grid.Enumerate(Position.get(), new Vector2(BulletExplosionDistance * 2)))
                {
                    if (o.GetType().IsSubclassOf(typeof(UnitShip)))
                    {
                        BasicShipGameObject s = (BasicShipGameObject)o;
                        float dist            = Vector2.Distance(s.Position.get(), Position.get()) - o.Size.X() / 2;

                        if (dist < BulletExplosionDistance && GetTeam() != s.GetTeam())
                        {
                            float DistMult = 1;
                            if (dist > 0)
                            {
                                DistMult = (BulletExplosionDistance - dist) / BulletExplosionDistance;
                            }
                            s.Damage(DistMult * BulletExplosionDamage, DistMult, Vector2.Normalize(s.Position.get() - Position.get()), this, AttackType.Explosion);
                        }
                    }
                }
            }
        }