示例#1
0
    //Do something based on each value
    public void HandlePowerup(PowerUpController powerUpController)
    {
        if (this.state.Equals(PowerupState.NoPowerup))
        {
            this.powerUpController = powerUpController;

            Powerup powerup = powerUpController.getPowerup();

            if (powerup.Equals(Powerup.Meteor))
            {
                //Rotate to meteor
                this.angle = (fullRotation * 2) + 7;
            }
            else if (powerup.Equals(Powerup.BlockSlow))
            {
                //Rotate to Block SLow
                this.angle = (fullRotation * 2) + (fullRotation / 8) * 3 + 7;
            }
            else if (powerup.Equals(Powerup.SpamBlock))
            {
                //Rotate to spam block
                this.angle = (fullRotation * 2) + (fullRotation / 16) * 3;
            }
            else if (powerup.Equals(Powerup.Shield))
            {
                //Rotate to base elevate
                this.angle = (fullRotation * 2) + (fullRotation / 4) + 7;
            }

            this.state = PowerupState.ActivePowerup;
        }
    }