Example #1
0
        //
        private void SelectPowerUp(Pile pile)
        {
            if (powerUpOn)
            {
                double r = random.NextDouble();
                if (r < .05)
                {
                    int x = random.Next(0, (int)PowerUps.freeze);

                    PowerUp newPower = new PowerUp(freeze.engine.attributes.color, freeze.engine.textures, powerUpOn)
                    {
                        attributes = new Attributes()
                        {
                            texture  = freeze.attributes.texture,
                            position = new Vector2(100, 100),
                            color    = Color.White
                        }
                    };
                    newPower.isSeeable = false;
                    newPower.WhenPlayed(delegate(Player player)
                    {
                        player.Freeze();
                        newPower.Fade(4);
                        if (player.isPlayer1)
                        {
                            newPower.Move(Actions.ExpoMove, yourSelector.attributes.position, 1);
                        }
                        else
                        {
                            newPower.Move(Actions.ExpoMove, oppSelector.attributes.position, 1);
                        }
                    });
                    base.Add(newPower);
                    pile.GivePowerUp(newPower);
                }
            }
        }
Example #2
0
        //
        private void SelectPowerUp(Pile pile)
        {
            if (powerUpOn)
            {
                double r = random.NextDouble();
                if (r < .05)
                {
                    int x = random.Next(0, (int)PowerUps.freeze);

                    PowerUp newPower = new PowerUp(freeze.engine.attributes.color, freeze.engine.textures, powerUpOn)
                    {
                        attributes = new Attributes()
                        {
                            texture = freeze.attributes.texture,
                            position = new Vector2(100, 100),
                            color = Color.White
                        }
                    };
                    newPower.isSeeable = false;
                    newPower.WhenPlayed(delegate(Player player)
                {
                    player.Freeze();
                    newPower.Fade(4);
                    if (player.isPlayer1) newPower.Move(Actions.ExpoMove, yourSelector.attributes.position, 1);
                    else newPower.Move(Actions.ExpoMove, oppSelector.attributes.position, 1);
                });
                    base.Add(newPower);
                    pile.GivePowerUp(newPower);
                }
            }
        }