예제 #1
0
 //This method gives the ship a speed boost.
 public void SpeedBoost()
 {
     if (Orbs.Count >= 3)
     {
         //    InvokeSoundEventForShip(this, SoundEffect.Boost);
         for (int i = 0; i < 3; ++i)
         {
             int orbIndex = rand.Next(Orbs.Count);
             Orbs.RemoveAt(orbIndex);
         }
         BoostFactor += 2.0;
     }
 }
예제 #2
0
 //This method gives the ship a speed boost.
 public void SpeedBoost()
 {
     if (Orbs.Count >= 3)
     {
         if (ParentGame.Player == this)
         {
             GameInvokeSoundEvent(this, SoundEffect.Boost);
         }
         for (int i = 0; i < 3; ++i)
         {
             int orbIndex = rand.Next(Orbs.Count);
             Orbs.RemoveAt(orbIndex);
         }
         BoostFactor += 2.0;
     }
 }
예제 #3
0
        public override void Update()
        {
            // Change particle colours
            Color newColour;

            // Exhaust/explosion colour
            switch (GM.instance.rnd.Next(3))
            {
            case 1:
                newColour = Color.Orange;
                break;

            case 2:
                newColour = Color.OrangeRed;
                break;

            default:
                newColour = Color.Red;
                break;
            }
            GM.instance.ParticleBases["exhaust"].Colour = newColour;
            // Accretion disk colour
            switch (GM.instance.rnd.Next(6))
            {
            case 1:
                newColour = Color.BlueViolet;
                break;

            case 2:
                newColour = Color.Red;
                break;

            case 3:
                newColour = Color.Purple;
                break;

            case 4:
                newColour = Color.PaleVioletRed;
                break;

            case 5:
                newColour = Color.Blue;
                break;

            default:
                newColour = Color.Purple;
                break;
            }
            GM.instance.ParticleBases["accretion"].Colour = newColour;

            // Update system objects
            foreach (GameObject obj in Objs)
            {
                obj.Update();
            }

            // Add queued objects to world
            UnqueueObjects();

            // Decay everything
            for (int i = Decayables.Count - 1; i > -1; i--)
            {
                if (Decayables[i].TTL < 0)
                {
                    var remove = Decayables[i];
                    if (remove.Equals(Shoot))
                    {
                        Shoot = null;
                    }
                    Decayables.RemoveAt(i);
                    Objs.Remove(remove as GameObject);
                }
                else
                {
                    break;
                }
            }

            // Attract to star
            Star.Attract(User as IGravitable);

            // Check collisions
            if (Shoot != null)
            {
                for (int i = Orbs.Count - 1; i > -1; i--)
                {
                    if ((Shoot.Pos - Orbs[i].Pos).Length() < 50)
                    {
                        Orbs[i].Explode();
                        Objs.Remove(Orbs[i] as GameObject);
                        Orbs.RemoveAt(i);
                        Objs.Remove(Shoot);
                        Shoot = null;
                        break;
                    }
                }
            }
        }