示例#1
0
 public void FirePowerUpEvent(PowerUpEventArgs e)
 {
     if (PowerUpEvent != null)
     {
         PowerUpEvent(this, e);
     }
 }
示例#2
0
        //event listener on powerup (collected power up)
        public void OnPowerUp(object sender, PowerUpEventArgs e)
        {
            switch (e.PowerUpEventType)
            {
            case PowerUpTypes.DOUBLE_ATTACK:
                //increase the number of bullet fire at once, maximum 4 bullet can be fire at once
                numberOfAttack = Math.Min(4, numberOfAttack + 1);
                break;

            case PowerUpTypes.SPEED_ATTACK:
                //increase the number of attack can be done in 1 second
                //maximum 6 attack can be done in 1 second
                attackPerSecond = Math.Min(6, attackPerSecond + 1);
                fireTime        = TimeSpan.FromMilliseconds(1000 / attackPerSecond);
                break;

            default:
                break;
            }
        }