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; } }
public void spawnCats(object o, SpawnEventArgs e) { for (int i = 0; i < 5; i++) { FlockingCat tmp = new FlockingCat(this.Game, (int)e.theVector.X, (int)e.theVector.Y); this.charList.Add(tmp); this.Game.Components.Add(tmp); tmp = null; } }