コード例 #1
0
 public BurningBuff(int dur, int lvl, AnimatedSprite target) :
     base("Burning", dur, lvl, "You're burning!", texture: TextureHelper.Blank(Color.Red))
 {
     Target  = target;
     OnStart = () =>
     {
         if (timer == null)
         {
             timer = new TimerHelper(
                 GameMathHelper.TimeToFrames(0.3f - (0.3f / 20f * (lvl - 1f))),
                 () => { Target.AddHealthIgnoreInvincibility(-(1 + (lvl / 2))); }
                 );
         }
     };
     OnEnd = () =>
     {
         timer?.Delete();
         timer = null;
     };
 }
コード例 #2
0
 public FrostbittenBuff(int dur, int lvl, AnimatedSprite target) : base("Frostbitten", dur, lvl, "You're really, really cold", texture: TextureHelper.Blank(Color.DarkBlue))
 {
     Target  = target;
     OnStart = () =>
     {
         if (timer == null)
         {
             target.terminalVelocity.X -= lvl * 30;
             timer = new TimerHelper(
                 GameMathHelper.TimeToFrames(1f - (1f / 100f * (lvl - 1f))),
                 () => { Target.AddHealthIgnoreInvincibility(-(1 + (lvl))); }
                 );
         }
     };
     OnEnd = () =>
     {
         target.terminalVelocity.X = AnimatedSprite.DefaultTerminalVelocity.X;
         timer?.Delete();
         timer = null;
     };
 }