public void Update(double dt) { foreach (IActor actor in NewActors) { Actors.Add(actor); } NewActors.Clear(); foreach (IActor actor in Actors) { actor.OnUpdate(dt); if (actor.MustBeDestroyed) { ActorsToRemove.Add(actor); } } foreach (IActor actor in ActorsToRemove) { actor.OnDestroy(); Game.PM.DeleteBoxComponent(actor.BC); Actors.Remove(actor); } ActorsToRemove.Clear(); }
public void Clear() { Actors.Clear(); NewActors.Clear(); }