public void Update(float deltaTime) { if (NextSyncTime >= 10 * 1000) { Send(new GameTimerMessage(0, GameTime / 1000f)); NextSyncTime = 0; } BlueTeam.Update(deltaTime); PurpleTeam.Update(deltaTime); NeutralTeam.Update(deltaTime); Map.Update(deltaTime); DelayedActions.RemoveAll(x => x.Finalized); foreach (var action in DelayedActions) { action.Update(deltaTime); } foreach (var unit in UnitsToRemove) { Map.RemoveUnit(unit); unit.Team.RemoveUnit(unit); unit.DefineTeam(null); unit.DefineGame(null); unit.Disposed = true; unit.PendingDispose = false; } UnitsToRemove.Clear(); }
public void DestroyUnit(Unit unit) { if (unit.Disposed || unit.PendingDispose) { logger.Write("Attempt to dispose " + unit + " failed. Already disposed", MessageState.ERROR); return; } unit.PendingDispose = true; UnitsToRemove.Add(unit); }
public void Update(float deltaTime) { if (NextSyncTime >= 10 * 1000) { Send(new GameTimerMessage(0, GameTime / 1000f)); NextSyncTime = 0; } BlueTeam.Update(deltaTime); PurpleTeam.Update(deltaTime); NeutralTeam.Update(deltaTime); Map.Update(deltaTime); foreach (var unit in UnitsToRemove) { Map.RemoveUnit(unit); unit.Team.RemoveUnit(unit); unit.DefineTeam(null); unit.DefineGame(null); } UnitsToRemove.Clear(); }
public void DestroyUnit(Unit unit) { UnitsToRemove.Add(unit); }