public override void update() { timer.update(); if (timer.isDone()) { enemyState = EnemyState.CHASEHERO; } switch (enemyState) { case EnemyState.BEGIN: moveLeft(); break; case EnemyState.CHASEHERO: chaseHero(); break; } if (this.getPosition().Collided(hero.getPosition())) { hero.kill(); } base.update(); }
public override void update() { if (GameWorld.Speed != 0) { timer.update(); foreach (Footprint t in trail) { t.update(); } } if (timer.isDone()) { timer.reset(); if (pool.Count > 0) { trail.Enqueue(pool.Dequeue()); trail.Last().init(character); } else { trail.Enqueue(new Footprint(character)); } } }
private void accelerateGame() { if (!stop) { accelerationTimer.update(); Speed = SpeedReference; } if (accelerationTimer.isDone()) { accelerationTimer.reset(); SpeedReference += 0.01f; } }
public override void update() { // remove any dead enemies foreach (Enemy e in enemies.Where(enemy => !enemy.isAlive())) { e.remove(); } enemies.RemoveAll(enemy => !enemy.isAlive()); foreach (Enemy e in enemies) { e.update(); } // prevent generating enemy if (GameWorld.Speed != 0) { newEnemyTimer.update(); } //generate new enemy if (newEnemyTimer.isDone()) { float randomY = XNACS1Base.RandomFloat(GameWorld.topEdge - 5, GameWorld.bottomEdge + 5); Vector2 position = new Vector2(GameWorld.rightEdge + 5, randomY); switch (XNACS1Base.RandomInt(0, 3)) { case 1: enemies.Add(new BrainEnemy(position, 7.5f, hero)); break; case 2: enemies.Add(new RedBeamEnemy(position, 7.5f, hero)); break; default: enemies.Add(new SpiderEnemy(position, 7.5f, hero)); break; } newEnemyTimer.reset(); } }
public void update() { if (timer.isDone()) { meter.Visible = false; if (deactivate != null) { deactivate(); deactivate = null; } } else { timer.update(); meter.Visible = true; meter.Height = initialMeterHeight * Math.Max(0, timer.currentTime() / initialTime); meter.CenterY = box.CenterY - ((initialMeterHeight - meter.Height) / 2); } }
public bool isDone() { return(timer.isDone()); }