public override void Update(GameTime gameTime) { if (gameTime.TotalGameTime - lastTick >= interval) { ChangeHealthEventArgs he; SpawnEventArgs se; switch (timerType) { case TimerType.HIT_TIMER: he = new ChangeHealthEventArgs(0); if (HTick != null) HTick(this, he); break; case TimerType.SPAWN: se = new SpawnEventArgs(location); if (STick != null) STick(this, se); break; default: break; } lastTick = gameTime.TotalGameTime; } }
void timer_HTick(object obj, ChangeHealthEventArgs e) { if (!this.attackable) { this.attackable = true; timer.Enabled = false; } }
public void changehp(object o, ChangeHealthEventArgs e) { HP += e.TheNumber; }