Server.PowerUp.randomizeType C# (CSharp) Méthode

randomizeType() public méthode

public randomizeType ( ) : void
Résultat void
        public void randomizeType()
        {
            //Randomize the type of the object
            Random random = new Random();
            //Choose a random spriteID and set the powerUpType based on the spriteID
            this.spriteID = random.Next(300, 310);
            switch (this.spriteID)
            {
                case 300:
                    //Lower reload rate compared to regular bullets
                    this.powerUpType = "Rapid Fire";
                    break;
                case 301:
                    //The player's gravity is reversed, preventing them from crashing into planets
                    this.powerUpType = "Anti-Gravity";
                    break;
                case 302:
                    //Fires 3 bullets at a time, at -7, 0 and 7 degrees respectively
                    this.powerUpType = "Spread Shot - 3";
                    break;
                case 303:
                    //Fires 5 bullets at a time, at -10, -5, 0, 5 and 10 degrees respectively
                    this.powerUpType = "Spread Shot - 5";
                    break;
                case 304:
                    //Provides upgraded movement speed and turning rate
                    this.powerUpType = "Engine Upgrade";
                    break;
                case 305:
                    //Homing bullets chase nearby players
                    this.powerUpType = "Homing Bullet";
                    break;
                case 306:
                    //Big bullets are extra large (Bigger radius) and deal extra damage
                    this.powerUpType = "Big Bullet";
                    break;
                case 307:
                    //Gravity bullets are regular bullets, only they have a strong gravitational pull (Like moons)
                    this.powerUpType = "Gravity Bullet";
                    break;
                case 308:
                    //Mines can be implemented as non-moving bullets that spawn behind the player's ship.  Make them affected by gravity
                    //so that they are eventually destroyed.
                    this.powerUpType = "Mine";
                    break;
                case 309:
                    //Lazers are very fast-moving bullets that are not affected by gravity
                    //The sprite for lazers will need to be rendered at a specific angle
                    this.powerUpType = "Lazer";
                    break;
                case 310:
                    //Ramming plate substantially increases the weight of the player's ship, causing it knock away enemy ships with
                    //a huge amount of force when it collides with them
                    this.powerUpType = "Ramming Plate";
                    break;
            }
        }