/// <summary> /// Create a new power-up in the world, if possible /// </summary> void SpawnPowerUp() { // check if there is a powerup in the world for (int i = 0; i < actors.Count; ++i) { if (actors[i] is PowerUp) { return; } } // create the new power-up PowerUp powerup = null; switch (random.Next(3)) { case 0: powerup = new DoubleLaserPowerUp(this); break; case 1: powerup = new TripleLaserPowerUp(this); break; case 2: powerup = new RocketPowerUp(this); break; } // add the new power-up to the world powerup.Spawn(true); }