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; }
public override void AbilityInit(GameCharacter gamechar, BCBlockGameState gstatem) { base.AbilityInit(gamechar, gstatem); //cached = gamechar.DrawAttributes; }
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); }
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; }
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; }
public abstract bool GivePowerTo(BCBlockGameState gamestate, GameCharacter gamechar);
public override bool GivePowerTo(BCBlockGameState gamestate, GameCharacter gamechar) { BCBlockGameState.Soundman.PlaySound("grow"); Block.AddScore(gamestate, 1000, Location); return true; }
public virtual void BeforeDraw(GameCharacter gamechar, Graphics g) { //nothing.... well, by default nothing. }
/// <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);
/// <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);
public abstract void AbilityInit(GameCharacter gamechar, BCBlockGameState gstatem);
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); }
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; }
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); }
public override void BeforeDraw(GameCharacter gamechar, Graphics g) { gamechar.DrawAttributes = usetheseattributes; base.BeforeDraw(gamechar, g); }
/// <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); }
/// <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... }
public override bool GivePowerTo(BCBlockGameState gamestate, GameCharacter gamechar) { return false; }