Example #1
0
        /// <summary>
        /// This gets called when a Pacman eats a PowerUp
        /// </summary>
        /// <param name="sender">The powerup that has been eaten</param>
        /// <param name="e">The event arguments</param>
        public void OnPowerUpPickedUp(object sender, PowerUpEffectEventArgs e)
        {
            PowerUp from = (PowerUp)sender;

            foreach (MovableObject movableObject in gameStateManager.MovableObjects)
            {
                Ghost ghost = movableObject as Ghost;
                if(ghost != null)
                {
                    ghost.PowerUpTimer = e.timer;
                    ghost.CellsPerSecond *= e.speed;
                    ghost.GhostBehaviour = e.ghostBehaviour;
                }
            }
        }
Example #2
0
 /// <summary>
 /// Fires an PwerUpEffectEvent when it is hit by a Pacman
 /// </summary>
 /// <param name="e"></param>
 public void InvokeOnPickedUp(PowerUpEffectEventArgs e)
 {
     PowerUpEffectEvent handler = OnPickedUp;
     if (handler != null) handler(this, e);
 }