Ejemplo n.º 1
0
 public override void TakeAction()
 {
     if (Carrier is CompositePart)
     {
         (Carrier as CompositePart).AddForce(EntityConstants.GetStatsFromID(EntityConstants.THRUST, id), ThrusterAngle);
     }
 }
Ejemplo n.º 2
0
 public override void SetStats(IDs id)
 {
     Friction  = EntityConstants.GetStatsFromID(EntityConstants.FRICTION, id);
     TurnSpeed = EntityConstants.GetStatsFromID(EntityConstants.TURNSPEED, id);
     Mass      = EntityConstants.GetStatsFromID(EntityConstants.MASS, id);
     base.SetStats(id);
 }
Ejemplo n.º 3
0
 public virtual void SetStats(IDs id)
 {
     Sprite = SpriteHandler.GetSprite((int)id);
     Team   = EntityConstants.GetStatsFromID(EntityConstants.TEAM, id);
     if (Sprite is Sprite)
     {
         Sprite.Origin = new Vector2(Sprite.SpriteRect.Width / 2, Sprite.SpriteRect.Height / 2);
     }
 }
Ejemplo n.º 4
0
 protected virtual void Fire()
 {
     projectiles.FireSpecificBullet(AbsolutePosition, new Vector2((float)Math.Cos(Angle), (float)Math.Sin(Angle)), bullet);
     if (Team != EntityConstants.GetStatsFromID(EntityConstants.TEAM, IDs.DEFAULT_ENEMY))
     {
         Traits.SHOTSFIRED.Counter++;
     }
     SoundHandler.PlaySoundEffect((int)id);
     EditBullet();
     bullet = (Projectile)projectiles.GetEntity((int)bulletID);
 }
Ejemplo n.º 5
0
 public override void Update(GameTime gameTime)
 {
     if (Team == EntityConstants.GetStatsFromID(EntityConstants.TEAM, IDs.DEFAULT_ENEMY)) // Flytta detta till particles?
     {
         Particles.GenerateParticles(Position, 4, Angle + (float)Math.PI, Color.Purple);
     }
     else
     {
         Particles.GenerateParticles(Position, 4, Angle + (float)Math.PI, Color.MonoGameOrange);
     }
 }
Ejemplo n.º 6
0
        //refactor buying out of this method
        private void AddPart(Part newPart)
        {
            if (newPart != null)
            {
                IsModified = true;
            }

            bool notEnoughMoney = false;  // only used to see if

            if (shipItems[activeSelection].id == IDs.RECTHULLPART)
            {
            }
            else if (activeSelection != 0)
            {
                ShipItem        pressedItem = shipItems[activeSelection];
                RectangularHull hull        = null;
                hull = pressedItem.Hull;
                // now redundant - graveyard functionality
                //if (pressedItem.id == IDs.RECTHULLPART)
                //{
                //    RemoveHull(pressedItem);
                //    FixLinkPosition(pressedItem); //!!!!!
                //}

                if (newPart == null)
                {
                    PlaceEmptyBox(pressedItem, hull);
                    UpgradeBar.SpentResource -= EntityConstants.PRICE[(int)pressedItem.id];
                }
                else
                {
                    float newPartPrice = EntityConstants.GetStatsFromID(EntityConstants.PRICE, EntityConstants.TypeToID(newPart.GetType()));
                    if (UpgradeBar.Resource >= newPartPrice)
                    {
                        PlacePart(pressedItem, hull, newPart);
                        UpgradeBar.SpentResource += newPartPrice;
                        UpgradeBar.SpentResource -= EntityConstants.PRICE[(int)pressedItem.id];
                    }
                    else
                    {
                        notEnoughMoney = true;
                    }
                }
                if (!notEnoughMoney)
                {
                    Vector2  v = pressedItem.Position;
                    ShipItem s = CreateShipItem(newPart, pressedItem.LinkPosition, v, (RectangularHull)hull);
                    shipItems[activeSelection] = s;
                    RenewEmptyBoxes();
                }
            }
        }
Ejemplo n.º 7
0
        protected virtual void EditBullet()
        {
            bullet.Team = Team;
            float fAngle = FiringAngle; //Check SprayGunPart's FiringAngle for deeper understanding of life

            if (Team == EntityConstants.GetStatsFromID(EntityConstants.TEAM, IDs.DEFAULT_ENEMY))
            {
                bullet.AddSpeed(EvilBulletSpeed, fAngle);
            }
            else
            {
                bullet.AddSpeed(BulletSpeed, fAngle);
            }
            bullet.Angle = fAngle;
        }
 private void SetName()
 {
     Name = EntityConstants.GetStatsFromID(EntityConstants.NAME, id);
 }
 private void SetPrice()
 {
     Price = (int)EntityConstants.GetStatsFromID(EntityConstants.PRICE, id);
 }
Ejemplo n.º 10
0
 public virtual void SetStats(IDs id)
 {
     Energy    = startingEnergy;
     maxEnergy = Energy;
     Damage    = EntityConstants.GetStatsFromID(EntityConstants.DAMAGE, id);
 }
Ejemplo n.º 11
0
 public override void SetStats(IDs id)
 {
     base.SetStats(id);
     WorthScore = EntityConstants.GetStatsFromID(EntityConstants.SCORE, id);
     friction   = EntityConstants.GetStatsFromID(EntityConstants.FRICTION, id) * Difficulty.ENEMY_FRICTIONFACTOR;
 }
Ejemplo n.º 12
0
        public void FillParts(CompositePart p)
        {
            p.ResetParts();
            int level = GameMode.Level;

            p.AddPart(new EnginePart(), 3);
            switch (level)
            {
                #region 1-10
            case 1:
                p.AddPart(new EnginePart(), 3);
                break;

            case 2:
                p.AddPart(new EnginePart(), 3);
                break;

            case 3:
                p.AddPart(new EnginePart(), 2);
                p.AddPart(new EnginePart(), 0);
                break;

            case 4:
                p.AddPart(new EnginePart(), 2);
                p.AddPart(new EnginePart(), 0);
                break;

            case 5:
                int n = SRandom.Next(0, 100);
                if (n < 50)
                {
                    p.AddPart(new EnginePart(), 3);
                }
                else
                {
                    p.AddPart(new EnginePart(), 0);
                    p.AddPart(new EnginePart(), 2);
                }
                if (n > 65)
                {
                    p.AddPart(new EnginePart(), 1);
                    p.AddPart(new EnginePart(), 3);
                    usingWaitTimer = true;
                }
                break;

            case 6:
                p.AddPart(new EnginePart(IDs.TURBOENGINEPART), 0);
                p.AddPart(new EnginePart(), 1);
                p.AddPart(new EnginePart(), 2);
                p.AddPart(new EnginePart(), 3);
                usingWaitTimer = true;
                break;

            case 7:
                p.AddPart(new EnginePart(IDs.TURBOENGINEPART), 0);
                p.AddPart(new EnginePart(), 1);
                p.AddPart(new EnginePart(), 2);
                p.AddPart(new EnginePart(), 3);
                usingWaitTimer = true;
                break;

            case 8:
                p.AddPart(new EnginePart(), 3);
                break;

            case 9:

                n = SRandom.Next(0, 100);
                if (n < 50)
                {
                    p.AddPart(new EnginePart(), 3); break;
                }
                if (n < 60)
                {
                    p.AddPart(new EnginePart(), 2); p.AddPart(new EnginePart(), 0); break;
                }
                usingWaitTimer = true;
                p.AddPart(new EnginePart(), 0);
                p.AddPart(new EnginePart(), 1);
                p.AddPart(new EnginePart(), 2);
                p.AddPart(new EnginePart(), 3);
                break;

            case 10:
                usingWaitTimer = true;
                Damage         = EntityConstants.GetStatsFromID(EntityConstants.DAMAGE, IDs.DEFAULT_ENEMY) * 50;
                CompositePart u = new RectangularHull(IDs.BOSS1);
                CompositePart d = new RectangularHull();
                CompositePart l = new RectangularHull();
                CompositePart r = new RectangularHull();
                p.AddPart(u, 1);
                p.AddPart(d, 3);
                p.AddPart(l, 2);
                p.AddPart(r, 0);
                u.AddPart(new EnginePart(IDs.TURBOENGINEPART), 0);
                u.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                u.AddPart(new EnginePart(IDs.TURBOENGINEPART), 2);
                d.AddPart(new EnginePart(IDs.TURBOENGINEPART), 0);
                d.AddPart(new EnginePart(IDs.TURBOENGINEPART), 2);
                d.AddPart(new EnginePart(IDs.TURBOENGINEPART), 3);
                l.AddPart(new EnginePart(IDs.TURBOENGINEPART), 2);
                r.AddPart(new EnginePart(IDs.TURBOENGINEPART), 0);

                break;

                #endregion
                #region 11-20
            case 11:
                p.AddPart(new EnginePart(), 3);
                p.AddPart(new GunPart(), 1);
                usingWaitTimer = true;
                break;

            case 12:
                p.AddPart(new EnginePart(), 3);
                p.AddPart(new GunPart(), 1);
                usingWaitTimer = true;
                break;

            case 13:
                p.AddPart(new EnginePart(), 3);
                p.AddPart(new GunPart(), 1);
                break;

            case 14:
                p.AddPart(new EnginePart(), 3);
                p.AddPart(new GunPart(), 1);
                break;

            case 15:

                n = SRandom.Next(0, 100);
                if (n < 50)
                {
                    p.AddPart(new EnginePart(), 3);
                }
                else
                {
                    p.AddPart(new EnginePart(), 0);
                    p.AddPart(new EnginePart(), 2);
                }
                if (n > 65)
                {
                    p.AddPart(new EnginePart(), 1);
                    p.AddPart(new EnginePart(), 3);
                    usingWaitTimer = true;
                }
                p.AddPart(new GunPart(), 1);
                usingWaitTimer = true;
                break;

            case 16:
                p.AddPart(new EnginePart(), 3);
                p.AddPart(new GunPart(), 1);
                p.AddPart(new GunPart(), 0);
                p.AddPart(new GunPart(), 2);
                usingWaitTimer = true;
                break;

            case 17:
                usingWaitTimer = true;
                p.AddPart(new GunPart(), 1);
                p.AddPart(new GunPart(), 0);
                p.AddPart(new GunPart(), 2);
                break;

            case 18:
                p.AddPart(new EnginePart(), 3);
                p.AddPart(new GunPart(), 1);
                usingWaitTimer = true;
                break;

            case 19:

                n = SRandom.Next(0, 100);
                p.AddPart(new EnginePart(), 3);
                if (n > 30)
                {
                    p.AddPart(new GunPart(), 1);
                }
                if (n > 70)
                {
                    p.AddPart(new GunPart(), 2); p.AddPart(new GunPart(), 0);
                }
                if (SRandom.Next(0, 100) > 50)
                {
                    usingWaitTimer = true;
                }
                break;

            case 20:
                TurnSpeed = 0.05f * (float)Math.PI;
                Damage    = EntityConstants.GetStatsFromID(EntityConstants.DAMAGE, IDs.DEFAULT_ENEMY) * 100;
                u         = new RectangularHull();
                CompositePart ul = new RectangularHull(IDs.BOSS2);
                CompositePart ur = new RectangularHull();
                l = new RectangularHull();
                r = new RectangularHull();
                CompositePart ld = new RectangularHull();
                CompositePart rd = new RectangularHull();
                p.AddPart(u, 1);
                p.AddPart(r, 0);
                p.AddPart(l, 2);
                p.AddPart(new EnginePart(), 3);
                u.AddPart(ur, 0);
                u.AddPart(ul, 2);
                u.AddPart(new GunPart(), 1);
                ul.AddPart(new GunPart(), 1);
                ur.AddPart(new GunPart(), 1);
                l.AddPart(new GunPart(), 2);
                r.AddPart(new GunPart(), 0);
                l.AddPart(ld, 3);
                r.AddPart(rd, 3);
                ld.AddPart(new EnginePart(), 3);
                rd.AddPart(new EnginePart(), 3);
                break;

                #endregion
                #region 21-30
            case 21:
                p.AddPart(new EnginePart(), 3);
                p.AddPart(new SprayGunPart(), 1);
                usingWaitTimer = true;
                break;

            case 22:
                p.AddPart(new EnginePart(), 3);
                p.AddPart(new SprayGunPart(), 1);
                usingWaitTimer = true;
                break;

            case 23:
                p.AddPart(new SprayGunPart(), 1);
                break;

            case 24:
                p.AddPart(new SprayGunPart(), 1);
                break;

            case 25:

                n = SRandom.Next(0, 100);
                if (n < 50)
                {
                    p.AddPart(new EnginePart(), 3);
                }
                else
                {
                    p.AddPart(new EnginePart(), 0);
                    p.AddPart(new EnginePart(), 2);
                }
                if (n > 65)
                {
                    p.AddPart(new EnginePart(), 1);
                    p.AddPart(new EnginePart(), 3);
                    usingWaitTimer = true;
                }
                p.AddPart(new SprayGunPart(), 1);
                usingWaitTimer = true;
                break;

            case 26:
                p.AddPart(new EnginePart(), 3);
                p.AddPart(new SprayGunPart(), 1);
                p.AddPart(new SprayGunPart(), 0);
                p.AddPart(new SprayGunPart(), 2);
                usingWaitTimer = true;
                break;

            case 27:
                usingWaitTimer = true;
                p.AddPart(new SprayGunPart(), 1);
                p.AddPart(new SprayGunPart(), 0);
                p.AddPart(new SprayGunPart(), 2);
                break;

            case 28:
                p.AddPart(new EnginePart(), 3);
                p.AddPart(new SprayGunPart(), 1);
                usingWaitTimer = true;
                break;

            case 29:

                n = SRandom.Next(0, 100);
                p.AddPart(new EnginePart(), 3);
                if (n > 30)
                {
                    usingWaitTimer = true;
                    p.AddPart(new SprayGunPart(), 1);
                }
                if (n > 70)
                {
                    usingWaitTimer = true;
                    p.AddPart(new SprayGunPart(), 2);
                    p.AddPart(new SprayGunPart(), 0);
                }
                if (SRandom.Next(0, 100) > 50)
                {
                    usingWaitTimer = true;
                }
                break;

            case 30:
                waitTimer.maxTime   = 10;
                attackTimer.maxTime = 6;
                waitTimer.Reset();
                attackTimer.Reset();
                specialMove = BOSS3;
                Damage      = EntityConstants.GetStatsFromID(EntityConstants.DAMAGE, IDs.DEFAULT_ENEMY) * 100;
                u           = new RectangularHull();
                d           = new RectangularHull();
                l           = new RectangularHull();
                r           = new RectangularHull();
                CompositePart uu = new RectangularHull(IDs.BOSS3);
                CompositePart dd = new RectangularHull();
                CompositePart ll = new RectangularHull();
                CompositePart rr = new RectangularHull();
                p.AddPart(u, 1);
                p.AddPart(r, 0);
                p.AddPart(l, 2);
                p.AddPart(d, 3);
                u.AddPart(uu, 1);
                d.AddPart(dd, 3);
                l.AddPart(ll, 2);
                r.AddPart(rr, 0);
                uu.AddPart(new SprayGunPart(), 1);
                dd.AddPart(new SprayGunPart(), 3);
                ll.AddPart(new SprayGunPart(), 2);
                rr.AddPart(new SprayGunPart(), 0);
                uu.AddPart(new EnginePart(), 0);
                uu.AddPart(new EnginePart(), 2);
                dd.AddPart(new EnginePart(), 0);
                dd.AddPart(new EnginePart(), 2);
                ll.AddPart(new EnginePart(), 1);
                ll.AddPart(new EnginePart(), 3);
                rr.AddPart(new EnginePart(), 1);
                rr.AddPart(new EnginePart(), 3);
                break;

                #endregion
                #region 31-40
            case 31:
                p.AddPart(new EnginePart(IDs.ENGINEPART), 3);
                p.AddPart(new SprayGunPart(), 1);
                p.AddPart(new ChargingGunPart(), 0);
                p.AddPart(new ChargingGunPart(), 2);
                usingWaitTimer = true;
                break;

            case 32:
                p.AddPart(new EnginePart(IDs.ENGINEPART), 3);
                p.AddPart(new SprayGunPart(), 1);
                p.AddPart(new ChargingGunPart(), 0);
                p.AddPart(new ChargingGunPart(), 2);
                usingWaitTimer = true;
                break;

            case 33:
                p.AddPart(new EnginePart(IDs.ENGINEPART), 3);
                p.AddPart(new ChargingGunPart(), 1);
                p.AddPart(new ChargingGunPart(), 0);
                p.AddPart(new ChargingGunPart(), 2);
                break;

            case 34:
                p.AddPart(new EnginePart(IDs.ENGINEPART), 3);
                p.AddPart(new ChargingGunPart(), 1);
                p.AddPart(new SprayGunPart(), 0);
                p.AddPart(new SprayGunPart(), 2);
                break;

            case 35:

                n = SRandom.Next(0, 100);
                if (n < 50)
                {
                    p.AddPart(new EnginePart(IDs.TURBOENGINEPART), 3);
                }
                else
                {
                    p.AddPart(new EnginePart(IDs.TURBOENGINEPART), 0);
                    p.AddPart(new EnginePart(), 2);
                }
                if (n > 65)
                {
                    p.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                    p.AddPart(new EnginePart(), 3);
                    usingWaitTimer = true;
                }
                p.AddPart(new ChargingGunPart(), 1);
                usingWaitTimer = true;
                break;

            case 36:
                p.AddPart(new EnginePart(IDs.ENGINEPART), 3);
                p.AddPart(new ChargingGunPart(), 1);
                p.AddPart(new ChargingGunPart(), 0);
                p.AddPart(new SprayGunPart(), 2);
                usingWaitTimer = true;
                break;

            case 37:
                usingWaitTimer      = true;
                attackTimer.maxTime = 3;
                attackTimer.Reset();
                p.AddPart(new ChargingGunPart(), 1);
                p.AddPart(new ChargingGunPart(), 0);
                p.AddPart(new ChargingGunPart(), 2);
                break;

            case 38:
                p.AddPart(new EnginePart(IDs.ENGINEPART), 3);
                p.AddPart(new ChargingGunPart(), 1);
                usingWaitTimer = true;
                break;

            case 39:

                n = SRandom.Next(0, 100);
                p.AddPart(new EnginePart(IDs.TURBOENGINEPART), 3);
                if (n > 30)
                {
                    usingWaitTimer = true;
                    p.AddPart(new ChargingGunPart(), 1);
                }
                if (n > 70)
                {
                    usingWaitTimer = true;
                    p.AddPart(new SprayGunPart(), 2);
                    p.AddPart(new SprayGunPart(), 0);
                }
                if (SRandom.Next(0, 100) > 50)
                {
                    usingWaitTimer = true;
                }
                break;

            case 40:
                waitTimer.maxTime   = 8;
                attackTimer.maxTime = 4;
                waitTimer.Reset();
                attackTimer.Reset();
                specialMove = BOSS3;
                Damage      = EntityConstants.GetStatsFromID(EntityConstants.DAMAGE, IDs.DEFAULT_ENEMY) * 100;
                u           = new RectangularHull();
                d           = new RectangularHull();
                l           = new RectangularHull();
                r           = new RectangularHull();
                CompositePart ll2 = new RectangularHull();
                CompositePart rr2 = new RectangularHull(IDs.BOSS4);
                p.AddPart(u, 1);
                p.AddPart(r, 0);
                p.AddPart(l, 2);
                p.AddPart(d, 3);
                l.AddPart(ll2, 2);
                r.AddPart(rr2, 0);
                u.AddPart(new ChargingGunPart(), 3);
                d.AddPart(new ChargingGunPart(), 1);
                l.AddPart(new ChargingGunPart(), 0);
                r.AddPart(new ChargingGunPart(), 2);
                u.AddPart(new SprayGunPart(), 1);
                d.AddPart(new SprayGunPart(), 3);
                ll2.AddPart(new GunPart(), 2);
                rr2.AddPart(new GunPart(), 0);
                ll2.AddPart(new EnginePart(), 1);
                ll2.AddPart(new EnginePart(), 3);
                rr2.AddPart(new EnginePart(), 1);
                rr2.AddPart(new EnginePart(), 3);
                break;

                #endregion
                #region 41-50
            case 41:     //F*****G PIRATES DUDE
                pirateRand = SRandom.Next(500, 1000);
                RectangularHull h1 = new RectangularHull();
                RectangularHull h2 = new RectangularHull();
                RectangularHull h3 = new RectangularHull();
                RectangularHull h4 = new RectangularHull();
                p.AddPart(h1, 3);
                p.AddPart(h2, 1);
                h2.AddPart(h3, 1);
                h1.AddPart(h4, 3);
                h4.AddPart(new EnginePart(IDs.TURBOENGINEPART), 3);
                h3.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                p.AddPart(new GunPart(), 0);
                p.AddPart(new GunPart(), 2);
                h1.AddPart(new GunPart(), 0);
                h1.AddPart(new GunPart(), 2);
                h2.AddPart(new GunPart(), 0);
                h2.AddPart(new GunPart(), 2);
                h3.AddPart(new GunPart(), 0);
                h3.AddPart(new GunPart(), 2);
                h4.AddPart(new GunPart(), 0);
                h4.AddPart(new GunPart(), 2);
                specialMove       = PIRATOS;
                TurnSpeed         = 0.1f * (float)Math.PI;
                waitTimer.maxTime = 0.1f;
                usingWaitTimer    = true;
                break;

            case 42:     //F*****G PIRATES DUDE
                pirateRand = SRandom.Next(500, 1000);

                h1 = new RectangularHull();
                h2 = new RectangularHull();
                p.AddPart(h1, 3);
                p.AddPart(h2, 1);
                h1.AddPart(new EnginePart(), 3);
                h2.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                p.AddPart(new GunPart(), 0);
                p.AddPart(new GunPart(), 2);
                h1.AddPart(new GunPart(), 0);
                h1.AddPart(new GunPart(), 2);
                h2.AddPart(new GunPart(), 0);
                h2.AddPart(new GunPart(), 2);
                specialMove       = PIRATOS;
                TurnSpeed         = 0.1f * (float)Math.PI;
                waitTimer.maxTime = 0.1f;
                usingWaitTimer    = true;
                break;

            case 43:     //F*****G PIRATES DUDE
                pirateRand = SRandom.Next(500, 1000);

                h1 = new RectangularHull();
                h2 = new RectangularHull();
                p.AddPart(h1, 3);
                p.AddPart(h2, 1);
                h1.AddPart(new EnginePart(), 3);
                h2.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                p.AddPart(new GunPart(), 0);
                p.AddPart(new GunPart(), 2);
                h1.AddPart(new GunPart(), 0);
                h1.AddPart(new GunPart(), 2);
                h2.AddPart(new GunPart(), 0);
                h2.AddPart(new GunPart(), 2);
                specialMove       = PIRATOS;
                TurnSpeed         = 0.1f * (float)Math.PI;
                waitTimer.maxTime = 0.1f;
                usingWaitTimer    = true;
                break;

            case 44:     //F*****G PIRATES DUDE
                pirateRand = SRandom.Next(500, 1000);

                h1 = new RectangularHull();
                h2 = new RectangularHull();
                p.AddPart(h1, 3);
                p.AddPart(h2, 1);
                h1.AddPart(new EnginePart(), 3);
                h2.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                p.AddPart(new GunPart(), 0);
                p.AddPart(new GunPart(), 2);
                h1.AddPart(new GunPart(), 0);
                h1.AddPart(new GunPart(), 2);
                h2.AddPart(new GunPart(), 0);
                h2.AddPart(new GunPart(), 2);
                specialMove       = PIRATOS;
                TurnSpeed         = 0.1f * (float)Math.PI;
                waitTimer.maxTime = 0.1f;
                usingWaitTimer    = true;
                break;

            case 45:     //F*****G PIRATES DUDE
                pirateRand = SRandom.Next(500, 1000);

                n = SRandom.Next(0, 100);
                if (n < 50)
                {
                    p.AddPart(new EnginePart(IDs.TURBOENGINEPART), 3);
                }
                else
                {
                    h1 = new RectangularHull();
                    h2 = new RectangularHull();
                    p.AddPart(h1, 3);
                    p.AddPart(h2, 1);
                    h1.AddPart(new EnginePart(), 3);
                    h2.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                    p.AddPart(new GunPart(), 0);
                    p.AddPart(new GunPart(), 2);
                    h1.AddPart(new GunPart(), 0);
                    h1.AddPart(new GunPart(), 2);
                    h2.AddPart(new GunPart(), 0);
                    h2.AddPart(new GunPart(), 2);
                    specialMove       = PIRATOS;
                    TurnSpeed         = 0.1f * (float)Math.PI;
                    waitTimer.maxTime = 0.1f;
                    usingWaitTimer    = true;
                }
                break;

            case 46:     //F*****G PIRATES DUDE
                pirateRand = SRandom.Next(500, 1000);

                h1 = new RectangularHull();
                h2 = new RectangularHull();
                h3 = new RectangularHull();
                h4 = new RectangularHull();
                p.AddPart(h1, 3);
                p.AddPart(h2, 1);
                h2.AddPart(h3, 1);
                h1.AddPart(h4, 3);
                h4.AddPart(new EnginePart(IDs.TURBOENGINEPART), 3);
                h3.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                p.AddPart(new GunPart(), 0);
                p.AddPart(new GunPart(), 2);
                h1.AddPart(new GunPart(), 0);
                h1.AddPart(new GunPart(), 2);
                h2.AddPart(new GunPart(), 0);
                h2.AddPart(new GunPart(), 2);
                h3.AddPart(new GunPart(), 0);
                h3.AddPart(new GunPart(), 2);
                h4.AddPart(new GunPart(), 0);
                h4.AddPart(new GunPart(), 2);
                specialMove       = PIRATOS;
                TurnSpeed         = 0.1f * (float)Math.PI;
                waitTimer.maxTime = 0.1f;
                usingWaitTimer    = true;
                break;

            case 47:     //F*****G PIRATES DUDE
                pirateRand = SRandom.Next(500, 1000);

                h1 = new RectangularHull();
                h2 = new RectangularHull();
                h3 = new RectangularHull();
                h4 = new RectangularHull();
                p.AddPart(h1, 3);
                p.AddPart(h2, 1);
                h2.AddPart(h3, 1);
                h1.AddPart(h4, 3);
                h4.AddPart(new EnginePart(IDs.TURBOENGINEPART), 3);
                h3.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                p.AddPart(new GunPart(), 0);
                p.AddPart(new GunPart(), 2);
                h1.AddPart(new GunPart(), 0);
                h1.AddPart(new GunPart(), 2);
                h2.AddPart(new GunPart(), 0);
                h2.AddPart(new GunPart(), 2);
                h3.AddPart(new GunPart(), 0);
                h3.AddPart(new GunPart(), 2);
                h4.AddPart(new GunPart(), 0);
                h4.AddPart(new GunPart(), 2);
                specialMove       = PIRATOS;
                TurnSpeed         = 0.1f * (float)Math.PI;
                waitTimer.maxTime = 0.1f;
                usingWaitTimer    = true;
                break;

            case 48:     //F*****G PIRATES DUDE
                pirateRand = SRandom.Next(500, 1000);

                n = SRandom.Next(0, 100);
                if (n < 70)
                {
                    h1 = new RectangularHull();
                    h2 = new RectangularHull();
                    p.AddPart(h1, 3);
                    p.AddPart(h2, 1);
                    h1.AddPart(new EnginePart(), 3);
                    h2.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                    p.AddPart(new GunPart(), 0);
                    p.AddPart(new GunPart(), 2);
                    h1.AddPart(new GunPart(), 0);
                    h1.AddPart(new GunPart(), 2);
                    h2.AddPart(new GunPart(), 0);
                    h2.AddPart(new GunPart(), 2);
                    specialMove       = PIRATOS;
                    TurnSpeed         = 0.1f * (float)Math.PI;
                    waitTimer.maxTime = 0.1f;
                    usingWaitTimer    = true;
                }
                else
                {
                    h1 = new RectangularHull();
                    h2 = new RectangularHull();
                    h3 = new RectangularHull();
                    h4 = new RectangularHull();
                    p.AddPart(h1, 3);
                    p.AddPart(h2, 1);
                    h2.AddPart(h3, 1);
                    h1.AddPart(h4, 3);
                    h4.AddPart(new EnginePart(IDs.TURBOENGINEPART), 3);
                    h3.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                    p.AddPart(new GunPart(), 0);
                    p.AddPart(new GunPart(), 2);
                    h1.AddPart(new GunPart(), 0);
                    h1.AddPart(new GunPart(), 2);
                    h2.AddPart(new GunPart(), 0);
                    h2.AddPart(new GunPart(), 2);
                    h3.AddPart(new GunPart(), 0);
                    h3.AddPart(new GunPart(), 2);
                    h4.AddPart(new GunPart(), 0);
                    h4.AddPart(new GunPart(), 2);
                    specialMove       = PIRATOS;
                    TurnSpeed         = 0.1f * (float)Math.PI;
                    waitTimer.maxTime = 0.1f;
                    usingWaitTimer    = true;
                }
                break;

            case 49:     //F*****G PIRATES DUDE
                pirateRand = SRandom.Next(400, 900);

                n = SRandom.Next(0, 100);
                if (n < 30)
                {
                    h1 = new RectangularHull();
                    h2 = new RectangularHull();
                    h3 = new RectangularHull();
                    h4 = new RectangularHull();
                    p.AddPart(h1, 3);
                    p.AddPart(h2, 1);
                    h2.AddPart(h3, 1);
                    h1.AddPart(h4, 3);
                    h4.AddPart(new EnginePart(IDs.TURBOENGINEPART), 3);
                    h3.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                    p.AddPart(new GunPart(), 0);
                    p.AddPart(new GunPart(), 2);
                    h1.AddPart(new GunPart(), 0);
                    h1.AddPart(new GunPart(), 2);
                    h2.AddPart(new GunPart(), 0);
                    h2.AddPart(new GunPart(), 2);
                    h3.AddPart(new GunPart(), 0);
                    h3.AddPart(new GunPart(), 2);
                    h4.AddPart(new GunPart(), 0);
                    h4.AddPart(new GunPart(), 2);
                    specialMove       = PIRATOS;
                    TurnSpeed         = 0.1f * (float)Math.PI;
                    waitTimer.maxTime = 0.1f;
                    usingWaitTimer    = true;
                }
                else
                if (n < 70)
                {
                }
                else
                {
                    h1 = new RectangularHull();
                    h2 = new RectangularHull();
                    p.AddPart(h1, 3);
                    p.AddPart(h2, 1);
                    h1.AddPart(new EnginePart(), 3);
                    h2.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                    p.AddPart(new GunPart(), 0);
                    p.AddPart(new GunPart(), 2);
                    h1.AddPart(new GunPart(), 0);
                    h1.AddPart(new GunPart(), 2);
                    h2.AddPart(new GunPart(), 0);
                    h2.AddPart(new GunPart(), 2);
                    specialMove       = PIRATOS;
                    TurnSpeed         = 0.1f * (float)Math.PI;
                    waitTimer.maxTime = 0.1f;
                    usingWaitTimer    = true;
                }
                break;

            case 50:
                pirateRand = 900;

                h1 = new RectangularHull(IDs.BOSS1);
                h2 = new RectangularHull();
                p.AddPart(h1, 3);
                p.AddPart(h2, 1);

                p.AddPart(new GunPart(), 0);
                p.AddPart(new GunPart(), 2);
                h1.AddPart(new GunPart(), 0);
                h1.AddPart(new GunPart(), 2);
                h2.AddPart(new GunPart(), 0);
                h2.AddPart(new GunPart(), 2);
                RectangularHull prevH1 = h1;
                RectangularHull prevH2 = h2;
                for (int i = 0; i < 8; i++)
                {
                    h1 = new RectangularHull();
                    h2 = new RectangularHull();
                    prevH1.AddPart(h1, 3);
                    prevH2.AddPart(h2, 1);
                    h1.AddPart(new GunPart(), 0);
                    h1.AddPart(new GunPart(), 2);
                    h2.AddPart(new GunPart(), 0);
                    h2.AddPart(new GunPart(), 2);
                    if (i == 9)
                    {
                        h1.AddPart(new EnginePart(IDs.TURBOENGINEPART), 3);
                        h2.AddPart(new EnginePart(IDs.TURBOENGINEPART), 1);
                    }
                    prevH1 = h1;
                    prevH2 = h2;
                }
                specialMove       = PIRATOSBOSS;
                TurnSpeed         = 0.1f * (float)Math.PI;
                waitTimer.maxTime = 0.1f;
                usingWaitTimer    = true;
                break;

                #endregion
                #region 51-60
            case 51:    //F*****G ABOMINATIONS
                createAbominations((RectangularHull)p, 15, 5);
                break;

            case 52:    //F*****G ABOMINATIONS
                createAbominations((RectangularHull)p, 6, 6);
                break;

            case 53:    //F*****G ABOMINATIONS
                createAbominations((RectangularHull)p, 8, 6);
                break;

            case 54:    //F*****G ABOMINATIONS
                createAbominations((RectangularHull)p, 10, 5);
                break;

            case 55:    //F*****G ABOMINATIONS
                createAbominations((RectangularHull)p, 12, 3);
                break;

            case 56:
                createAbominations((RectangularHull)p, 16, 4);
                break;

            case 57:
                createAbominations((RectangularHull)p, 7, 3);
                break;

            case 58:
                createAbominations((RectangularHull)p, 5, 3);
                break;

            case 59:
                createAbominations((RectangularHull)p, 6, 4);
                break;

            case 60:
                createAbominations((RectangularHull)p, 70, 15);
                specialMove = 0;
                break;

                #endregion
            case 61:
                waitTimer.maxTime   = 1;
                attackTimer.maxTime = 4;
                waitTimer.Reset();
                attackTimer.Reset();
                specialMove = 5;
                Damage      = EntityConstants.GetStatsFromID(EntityConstants.DAMAGE, IDs.DEFAULT_ENEMY) * 100;
                RectangularHull boss5Hull = new RectangularHull(IDs.BOSS1);
                p.AddPart(boss5Hull, 0);
                p.AddPart(new EnginePart(), 3);
                p.AddPart(new GunPart(), 1);

                break;

            default:
                n = SRandom.Next(0, 100);
                p.AddPart(new EnginePart(), 3);
                break;
            }
        }
Ejemplo n.º 13
0
        private void HandleAllCollisions()
        {
            List <Collidable> pParts   = Player.Parts.ConvertAll(p => (Collidable)p);
            List <Collidable> eParts   = Enemies.GetValues().Where(e => ((Enemy)e).IsActive).SelectMany(e => ((Enemy)e).Parts).ToList().ConvertAll(p => (Collidable)p);
            List <Collidable> pBullets = Projectiles.GetValues().Where(p => ((Projectile)p).Team != EntityConstants.GetStatsFromID(EntityConstants.TEAM, IDs.DEFAULT_ENEMY) && ((Projectile)p).IsActive).ToList().ConvertAll(p => (Collidable)p);
            List <Collidable> eBullets = Projectiles.GetValues().Where(p => ((Projectile)p).Team == EntityConstants.GetStatsFromID(EntityConstants.TEAM, IDs.DEFAULT_ENEMY) && ((Projectile)p).IsActive).ToList().ConvertAll(p => (Collidable)p);
            List <Collidable> eDrops   = Drops.GetValues().Where(d => ((Drop)d).IsActive).ToList().ConvertAll(p => (Collidable)p);

            colHandler.CheckCollisions(pParts, eParts);
            colHandler.CheckCollisions(pParts, eBullets);
            colHandler.CheckCollisions(pParts, eDrops);
            colHandler.CheckCollisions(eParts, pBullets);
        }