public static void Update(GameTime gameTime, Random random, ContentManager content) { foreach (Hazard Hazard in busyHazards) { Hazard.Update(gameTime); if (!Hazard.Alive) { tempHazards.Add(Hazard); } } foreach (Hazard Hazard in tempHazards) { availableHazards.Add(Hazard); busyHazards.Remove(Hazard); } tempHazards.Clear(); MemoryDebug.Update(); StringBuilder msg = new StringBuilder("Available Hazards: "); msg.Append(availableHazards.Count.ToString()); msg.Append(" ,Busy Hazards: "); msg.Append(busyHazards.Count.ToString()); msg.Append(" Total: "); msg.Append((busyHazards.Count + availableHazards.Count).ToString()); string finalMsg = msg.ToString(); MessageBus.InsertNewMessage(new ConsoleMessage(finalMsg)); }
public static void Update(GameTime gameTime, Random random, ContentManager content) { tempTimer += gameTime.ElapsedGameTime.TotalSeconds; foreach (Ship ship in busyShips) { ship.Update(gameTime); if (!ship.Alive) { tempShips.Add(ship); } } foreach (Ship ship in tempShips) { availableShips.Add(ship); busyShips.Remove(ship); SpawnShip(random, content); } tempShips.Clear(); if (tempTimer >= spawnTime) { foreach (Ship ship in busyShips) { if (ship != playerShip) { ship.Yaw = random.Next(0, 1000); ship.Roll = random.Next(0, 1000); ship.Pitch = random.Next(0, 1000); } } tempTimer -= spawnTime; } //Memory stuff MemoryDebug.Update(); StringBuilder msg = new StringBuilder("Available ships: "); msg.Append(availableShips.Count.ToString()); msg.Append(" ,Busy Ships: "); msg.Append(busyShips.Count.ToString()); msg.Append(" Total: "); msg.Append((busyShips.Count + availableShips.Count).ToString()); string finalMsg = msg.ToString(); MessageBus.InsertNewMessage(new ConsoleMessage(finalMsg)); }