public void Run() { IList <IQuelea> toRemove = new List <IQuelea>(); foreach (IQuelea quelea in Quelea) { quelea.Environment = environment; quelea.Run(); if (quelea.IsDead()) { toRemove.Add(quelea); } } foreach (AbstractEmitterType emitter in emitters) { if (emitter.ContinuousFlow && (timestep % emitter.CreationRate == 0)) { if ((emitter.NumAgents == 0) || (Quelea.Count < emitter.NumAgents)) { Add(emitter); } } } Quelea = UpdateDynamicSpatialDataStructure((IList <IQuelea>)Quelea.SpatialObjects); foreach (IQuelea deadParticle in toRemove) { Quelea.Remove(deadParticle); } timestep++; }
public void Run() { UpdateBounds(); Quelea.UpdateDatastructure(min, max, (int)(Number.Clamp((min.DistanceTo(max) / 5), 5, 25)), (IList <T>)Quelea.SpatialObjects); IList <T> toRemove = new List <T>(); foreach (T quelea in Quelea) { quelea.Run(); if (environment != null) { quelea.RefPosition = environment.ClosestRefPointOnRef(quelea.RefPosition); quelea.Position = environment.ClosestPointOnRef(quelea.RefPosition); } else { quelea.RefPosition = quelea.Position; quelea.Position = quelea.RefPosition; } quelea.PositionHistory.Add(quelea.Position); if (quelea.IsDead()) { toRemove.Add(quelea); } } foreach (AbstractEmitterType emitter in emitters) { if (emitter.ContinuousFlow && (timestep % emitter.CreationRate == 0)) { if ((emitter.NumAgents == 0) || (Quelea.Count < emitter.NumAgents)) { Add(emitter); } } } foreach (T deadQuelea in toRemove) { Quelea.Remove(deadQuelea); } timestep++; }
public void RemoveCollider(Collider collider) { _colliders.Remove(collider); }