Exemplo n.º 1
0
        private void UndoPower(PowerUpEffect power)
        {
            switch (power.PowerUpEffectAction)
            {
            case PowerUpEffectAction.Grow:
                Shrink(3);
                break;

            case PowerUpEffectAction.Shrink:
                Grow(2);
                break;

            case PowerUpEffectAction.Slider_Guns:
                hasGuns = false;
                RemoveGuns(ConsoleColor.Black);
                break;

            case PowerUpEffectAction.Mega_Slider_Guns:
                hasMegaGuns = false;
                RemoveGuns(ConsoleColor.Red);
                break;
            }
            this.PowerUpEffects.Remove(power);
            GameObjectCollection.ActivePowerUps.Remove(power.ToString());
        }
Exemplo n.º 2
0
        private void ProcessPower(PowerUpEffect power)
        {
            switch (power.PowerUpEffectAction)
            {
            case PowerUpEffectAction.Grow:
                Grow(3);
                break;

            case PowerUpEffectAction.Shrink:
                Shrink(2);
                break;

            case PowerUpEffectAction.Slider_Guns:
                //only allow one set of guns at a time
                if (!hasMegaGuns)
                {
                    hasGuns  = true;
                    fireRate = TimeSpan.FromMilliseconds(1000);
                    AddGuns(ConsoleColor.Black);
                }
                break;

            case PowerUpEffectAction.Mega_Slider_Guns:
                hasMegaGuns = true;
                //remove normal guns if they exist
                RemoveGuns(ConsoleColor.Black);
                hasGuns  = false;
                fireRate = TimeSpan.FromMilliseconds(100);

                AddGuns(ConsoleColor.Red);
                break;
            }
            GameObjectCollection.ActivePowerUps.Add(power.ToString());
        }
Exemplo n.º 3
0
        private void UndoPower(PowerUpEffect power)
        {
            switch (power.PowerUpEffectAction)
            {
            case PowerUpEffectAction.Grow:
                ResetSize();
                break;

            case PowerUpEffectAction.DecreaseSpeed:
                Speed *= 2;
                break;

            case PowerUpEffectAction.IncreaseSpeed:
                Speed /= 2;
                break;

            case PowerUpEffectAction.Ball_Split:
                GameObjectCollection.GetActive <Ball>(x => !x.IsMainBall).ForEach(x => x.IsActive = false);
                break;

            case PowerUpEffectAction.Ball_MultiBrickBreak:
                MultiBrickBreak = false;

                break;
            }
            this.PowerUpEffects.Remove(power);
            GameObjectCollection.ActivePowerUps.Remove(power.ToString());
        }
Exemplo n.º 4
0
        private void ProcessPower(PowerUpEffect power)
        {
            switch (power.PowerUpEffectAction)
            {
            case PowerUpEffectAction.Grow:
                Grow();
                break;

            case PowerUpEffectAction.Ball_Split:
                Split();
                break;

            case PowerUpEffectAction.DecreaseSpeed:
                Speed /= 2;
                break;

            case PowerUpEffectAction.IncreaseSpeed:
                Speed *= 2;
                break;

            case PowerUpEffectAction.Ball_MultiBrickBreak:
                MultiBrickBreak = true;
                break;
            }
            GameObjectCollection.ActivePowerUps.Add(power.ToString());
        }
Exemplo n.º 5
0
 public static PowerUpEffect From(PowerUpEffect power, string name, TimeSpan?duration = null, TimeSpan?activationTime = null, bool?processed = null)
 {
     return(new PowerUpEffect()
     {
         Duration = duration ?? power.Duration,
         ActivationTime = activationTime ?? power.ActivationTime,
         PowerUpEffectAction = power.PowerUpEffectAction,
         Processed = processed ?? power.Processed,
         Name = name
     });
 }
Exemplo n.º 6
0
 private void HandlePowerUps(GameTime gameTime)
 {
     for (int i = 0; i < PowerUpEffects.Count; i++)
     {
         if (!PowerUpEffects[i].Processed)
         {
             ProcessPower(PowerUpEffects[i]);
             PowerUpEffects[i] = PowerUpEffect.From(PowerUpEffects[i], PowerUpEffects[i].Name, null, gameTime.TotalElapsedTime, true);
         }
         else
         {
             if (gameTime.TotalElapsedTime - PowerUpEffects[i].ActivationTime > PowerUpEffects[i].Duration)
             {
                 UndoPower(PowerUpEffects[i]);
             }
         }
     }
 }