Пример #1
0
        public override bool GivePowerTo(BCBlockGameState gamestate, GameCharacter gamechar)
        {
            bool founditem = false;
            foreach (GameCharacterAbility gca in gamechar.Abilities)
            {

                if (gca is InvinciblePowerupAbility)
                {
                    InvinciblePowerupAbility ipa = gca as InvinciblePowerupAbility;
                    ipa.AbilityStart = DateTime.Now; //reset.
                    ipa.ChangeDelayTime(gamestate, gamestate.GetDelayData(ipa.DelayIdentifier).waitdelay,true);
                    founditem = true;
                    break;

                }

            }
            if (!founditem)
            {
                //if there is no invincible powerup, we add it.
                InvinciblePowerupAbility newpower = new InvinciblePowerupAbility();
                gamechar.Abilities.Add(newpower);

            }
            BCBlockGameState.Soundman.PlaySound("grow");
            Block.AddScore(gamestate, 1000, Location);
            return true;
        }