Ejemplo n.º 1
0
        public override bool GivePowerTo(BCBlockGameState gamestate, GameCharacter gamechar)
        {
            BCBlockGameState.Soundman.PlaySound("1up");
            BasicFadingText bft = new BasicFadingText("1-Up", Location, new PointF(0, -2), new Font(BCBlockGameState.GetMonospaceFont(), 14), new Pen(Color.Black,2), new SolidBrush(Color.Green), 500);

            gamestate.playerLives++;
            gamestate.Forcerefresh = true;
            gamestate.Defer(() => gamestate.GameObjects.AddLast(bft));

            return true;
        }
Ejemplo n.º 2
0
 public override void AbilityInit(GameCharacter gamechar, BCBlockGameState gstatem)
 {
     base.AbilityInit(gamechar, gstatem);
     //cached = gamechar.DrawAttributes;
 }
Ejemplo n.º 3
0
        public override bool AbilityFrame(GameCharacter gamechar, BCBlockGameState gstatem)
        {
            delayvalue++;
            if (delayvalue == delayfactor)
            {
                usetheseattributes = BCBlockGameState.Choose(useDrawAttributes);
                delayvalue = 0;
            }
            //also spawn a sparkly. One sparkley per frame.
            //choose a random colour...
            Random rg = BCBlockGameState.rgen;
            Color usecolor = new HSLColor(BCBlockGameState.rgen.NextDouble()*240, 240, 120);
            //select a random position.
            RectangleF baserect = gamechar.GetRectangleF();
            PointF randompos = new PointF(baserect.Left + (float)(baserect.Width * rg.NextDouble()), baserect.Top + (float)(baserect.Height * rg.NextDouble()));

            PointF RandomVelocity = new PointF((float)rg.NextDouble()*0.5f-0.25f,(float)rg.NextDouble()*0.5f-0.25f);

            Sparkle sp = new Sparkle(randompos, RandomVelocity, usecolor);
            sp.MaxRadius = 5;
            gstatem.Particles.Add(sp);

            return base.AbilityFrame(gamechar, gstatem);
        }
Ejemplo n.º 4
0
 public override void AbilityEnd(GameCharacter gamechar, BCBlockGameState gstate, ref List<GameObject> addobjects, ref List<GameObject> removeobjects, ref List<GameCharacterAbility> addabilities)
 {
     base.AbilityEnd(gamechar, gstate, ref addobjects, ref removeobjects, ref addabilities);
     //gamechar.DrawAttributes = cached;
 }
Ejemplo n.º 5
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;
        }
Ejemplo n.º 6
0
 public abstract bool GivePowerTo(BCBlockGameState gamestate, GameCharacter gamechar);
Ejemplo n.º 7
0
 public override bool GivePowerTo(BCBlockGameState gamestate, GameCharacter gamechar)
 {
     BCBlockGameState.Soundman.PlaySound("grow");
     Block.AddScore(gamestate, 1000, Location);
     return true;
 }
Ejemplo n.º 8
0
 public virtual void BeforeDraw(GameCharacter gamechar, Graphics g)
 {
     //nothing.... well, by default nothing.
 }
Ejemplo n.º 9
0
 /// <summary>
 /// called when gamecharacter collides with a platformobject.
 /// </summary>
 /// <param name="gstate"></param>
 /// <param name="gamechar"></param>
 /// <param name="otherobject"></param>
 /// <returns>false to continue default processing. true to return immediately without default processing.</returns>
 public abstract bool Collide(BCBlockGameState gstate, GameCharacter gamechar, PlatformObject otherobject);
Ejemplo n.º 10
0
 /// <summary>
 /// Called during the gamecharacter frame for each ability.
 /// </summary>
 /// <param name="gamechar"></param>
 /// <param name="gstatem"></param>
 /// <returns>true to remove this ability. False otherwise.</returns>
 public abstract bool AbilityFrame(GameCharacter gamechar, BCBlockGameState gstatem);
Ejemplo n.º 11
0
 public abstract void AbilityInit(GameCharacter gamechar, BCBlockGameState gstatem);
Ejemplo n.º 12
0
 public override void AbilityInit(GameCharacter gamechar, BCBlockGameState gstatem)
 {
     gamechar.OnDeath += gamechar_OnDeath;
     DelayIdentifier = gstatem.DelayInvoke(_Duration, revertroutinefunc, new object[] { gamechar, gstatem });
     AbilityStart = DateTime.Now;
     if (!String.IsNullOrEmpty(_AbilityMusic))
         //BCBlockGameState.Soundman.PushMusic(_AbilityMusic, 1.0f, true);
         BCBlockGameState.Soundman.PlayTemporaryMusic(_AbilityMusic, 1.0f, true);
 }
Ejemplo n.º 13
0
 public override bool AbilityFrame(GameCharacter gamechar, BCBlockGameState gstatem)
 {
     /*
     if ((DateTime.Now - AbilityStart) > _Duration)
     {
         AbilityEnd(gamechar, gstatem, ref addobjects, ref removeobjects, ref addabilities);
         return true;
     }
     */
     return AbilityEnded;
 }
Ejemplo n.º 14
0
 public virtual void AbilityEnd(GameCharacter gamechar, BCBlockGameState gstate, ref List<GameObject> addobjects, ref List<GameObject> removeobjects, ref List<GameCharacterAbility> addabilities)
 {
     //called when ability is "over"
        // BCBlockGameState.Soundman.PopMusic(_AbilityMusic);
     AbilityEnded = true;
     BCBlockGameState.Soundman.StopTemporaryMusic(_AbilityMusic);
 }
Ejemplo n.º 15
0
        public override void BeforeDraw(GameCharacter gamechar, Graphics g)
        {
            gamechar.DrawAttributes = usetheseattributes;

            base.BeforeDraw(gamechar, g);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// return true to remove this ability from the character.
        /// </summary>
        /// <param name="gamechar"></param>
        /// <param name="gstatem"></param>
        /// <returns></returns>
        public bool PerformFrame(GameCharacter gamechar, BCBlockGameState gstatem)
        {
            if (!flInit)
            {
                flInit = true;
                AbilityInit(gamechar, gstatem);

            }
            return AbilityFrame(gamechar, gstatem);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// called when gamecharacter collides with a platformobject.
        /// </summary>
        /// <param name="gstate"></param>
        /// <param name="gamechar"></param>
        /// <param name="otherobject"></param>
        /// <returns>false to continue default processing. true to return immediately without default processing.</returns>
        public override bool Collide(BCBlockGameState gstate, GameCharacter gamechar, PlatformObject otherobject)
        {
            //kill the other object, and leave us unaffected.
            //but- only for types deriving from PlatformEnemy

            if(otherobject is PlatformEnemy)
            {
                otherobject.Kill();

            return true;
              }
                return false; //default processing...
        }
Ejemplo n.º 18
0
 public override bool GivePowerTo(BCBlockGameState gamestate, GameCharacter gamechar)
 {
     return false;
 }