private void AIShoot() { if (FireSound != null) { FireSound.Play(); } Vector3 point = gameObject.transform.forward; Vector3 StartingPoint; if (ShootingZone != null) { StartingPoint = ShootingZone.transform.position; } else { StartingPoint = gameObject.transform.position; } CmdShoot(point, StartingPoint); }
public void Update(GameTime time) { if (KeyboardHelper.KeyPressed(Keys.Escape)) { paused = !paused; if (paused) { return; } } heatMap.UpdateBegin(time); winTimer.Update(time); fireSndTimer.Update(time); fireExtSndTimer.Update(time); if (winTimer.HasTick()) { if (game.LevelSelectScreen.Progress < levelId) { game.LevelSelectScreen.Progress = levelId; } game.ChangeScreen(game.LevelEndScreen.SetWin(true)); } else if (gameObjectInstances.Where(inst => !inst.IsDestroyed).Sum(inst => inst.Type.Cost) < startingCost / 3 || player.IsDead) { game.ChangeScreen(game.LevelEndScreen.SetWin(false)); } foreach (var inst in gameObjectInstances) { inst.Update(time, heatMap, partSystem, this); } foreach (var inst in gameObjectInstances) { inst.UpdateFromHeatmap(heatMap); } partSystem.Update(time); foreach (var agent in partSystem.GetAgents()) { var c = agent.CollisionMask; foreach (var inst in gameObjectInstances) { if (inst.IsBurning && inst.CollidesWith(c)) { inst.Extinguish(agent.Type); } } heatMap.CoolDown(new Point(c.X, c.Y)); if (wallColliders.Any(w => w.CollidesWith(c))) { agent.Kill(); } } player.Update(time, heatMap, partSystem); if (gameObjectInstances.Any(inst => inst.IsBurning)) { winTimer.Reset(); } if (fireSndTimer.HasTick()) { var b = Math.Min(2000f, gameObjectInstances.Sum(inst => inst.Burning)); if (b > 0) { FireSound.Play(b / 2000f, 0f, 0f); } } fireSndTimer.TakeTicks(); fireExtSndTimer.TakeTicks(); }