예제 #1
0
        private void UsePickUp(PickUp pickUp)
        {
            switch (pickUp.PickUpPowerUp)
            {
                case PickUpType.FastBall:
                    this.speed += 300;
                    break;
                case PickUpType.MultiBall:
                    GameWorld.NewObjects.Add(PoolManager.CreateBall());
                    break;
                case PickUpType.SplitAndSlowBall:
                    float savedDir = this.Velocity.X;
                    Ball extraBall = PoolManager.CreateBall();
                    extraBall.Velocity = new Vector2(savedDir, -10);
                    extraBall.Position = this.Position;
                    this.Velocity = new Vector2(savedDir, 10);
                    this.speed -= 100;
                    extraBall.speed -= 100;
                    GameWorld.NewObjects.Add(extraBall);
                    break;
                case PickUpType.BigBall:
                    PlayAnimation("BigBall");
                    break;
                case PickUpType.SmallBall:
                    PlayAnimation("SmallBall");
                    break;
                case PickUpType.ColorChange:
                    this.Color = new Color(
                         (byte)RandomPicker.Rnd.Next(0, 255),
                         (byte)RandomPicker.Rnd.Next(0, 255),
                         (byte)RandomPicker.Rnd.Next(0, 255));
                    break;

                default:
                    break;
            }
        }
예제 #2
0
 private void SetupPickUp(PickUp pick)
 {
     switch (pick.PickUpPowerUp)
     {
         case PickUpType.SlowPlayer:
             hasEndTime = true;
             effectTime = 20;
             break;
         case PickUpType.FastPlayer:
             hasEndTime = true;
             effectTime = 20;
             break;
         case PickUpType.FastBall:
             hasEndTime = false;
             break;
         case PickUpType.MultiBall:
             hasEndTime = false;
             break;
         case PickUpType.BigPlayer:
             hasEndTime = true;
             effectTime = 15;
             break;
         case PickUpType.SmallPlayer:
             hasEndTime = true;
             effectTime = 15;
             break;
         case PickUpType.xScore:
             hasEndTime = false;
             break;
         case PickUpType.SplitAndSlowBall:
             hasEndTime = false;
             break;
         case PickUpType.ColorChange:
             hasEndTime = false;
             break;
         case PickUpType.BigBall:
             hasEndTime = false;
             break;
         case PickUpType.SmallBall:
             hasEndTime = false;
             break;
         case PickUpType.InverseControl:
             hasEndTime = true;
             effectTime = 40;
             break;
         default:
             break;
     }
 }
예제 #3
0
        private void HandlePickUp(PickUp pickUp)
        {
            switch (pickUp.PickUpPowerUp)
            {
                case PickUpType.SlowPlayer:
                    if (lastHitPlayer != null && !lastHitPlayer.HasPowerUp)
                    {
                        lastHitPlayer.HandlePickUp(pickUp);
                        GameWorld.ObjectsToRemove.Add(pickUp);
                    }
                    break;

                case PickUpType.FastPlayer:
                    if (lastHitPlayer != null && !lastHitPlayer.HasPowerUp)
                    {
                        lastHitPlayer.HandlePickUp(pickUp);
                        GameWorld.ObjectsToRemove.Add(pickUp);
                    }
                    break;

                case PickUpType.FastBall:
                    GameWorld.ObjectsToRemove.Add(pickUp);
                    UsePickUp(pickUp);
                    break;

                case PickUpType.MultiBall:
                    GameWorld.ObjectsToRemove.Add(pickUp);
                    UsePickUp(pickUp);
                    break;

                case PickUpType.BigPlayer:
                    if (lastHitPlayer != null && !lastHitPlayer.HasPowerUp)
                    {
                        lastHitPlayer.HandlePickUp(pickUp);
                        GameWorld.ObjectsToRemove.Add(pickUp);
                    }
                    break;

                case PickUpType.SmallPlayer:
                    if (lastHitPlayer != null && !lastHitPlayer.HasPowerUp)
                    {
                        lastHitPlayer.HandlePickUp(pickUp);
                        GameWorld.ObjectsToRemove.Add(pickUp);
                    }
                    break;

                case PickUpType.xScore:
                    if (lastHitPlayer != null && !lastHitPlayer.HasPowerUp)
                    {
                        lastHitPlayer.HandlePickUp(pickUp);
                        GameWorld.ObjectsToRemove.Add(pickUp);
                    }
                    break;

                case PickUpType.SplitAndSlowBall:
                    GameWorld.ObjectsToRemove.Add(pickUp);
                    UsePickUp(pickUp);
                    break;

                case PickUpType.ColorChange:
                    if (lastHitPlayer != null && !lastHitPlayer.HasPowerUp)
                    {
                        lastHitPlayer.HandlePickUp(pickUp);
                        GameWorld.ObjectsToRemove.Add(pickUp);
                    }
                    foreach (GameObject go in GameWorld.Objects)
                    {
                        if (go is Obstacles)
                        {
                            Obstacles temp = go as Obstacles;
                            temp.HandlePickUp(pickUp);
                        }

                    }
                    UsePickUp(pickUp);
                    break;

                case PickUpType.BigBall:
                    GameWorld.ObjectsToRemove.Add(pickUp);
                    UsePickUp(pickUp);
                    break;

                case PickUpType.SmallBall:
                    GameWorld.ObjectsToRemove.Add(pickUp);
                    UsePickUp(pickUp);
                    break;

                case PickUpType.InverseControl:
                    if (lastHitPlayer != null && !lastHitPlayer.HasPowerUp)
                    {
                        lastHitPlayer.HandlePickUp(pickUp);
                        GameWorld.ObjectsToRemove.Add(pickUp);
                    }
                    break;
                default:
                    break;
            }
        }