public void Clear() { _timer.Close(); _activeCircles.Clear(); _collisionsDetector = null; _circleSpawner = null; _circleDestroyer = null; GC.Collect(); }
private void Init(Circle[] unspawnedCircles, Circle[] spawnedCircles, Settings settings) { Settings = settings; _activeCircles = new List <Circle>(spawnedCircles.Length + unspawnedCircles.Length); var size = new Vector2(settings.GameAreaWidth, settings.GameAreaHeight); CalculateSimulationRate(settings.MaxUnitSpeed, settings.MinUnitRadius); int elapsedTime = IterationsCount * DeltaTime(); _circleSpawner = new CirclesSpawner(unspawnedCircles, spawnedCircles, settings.UnitSpawnDelay, _activeCircles, elapsedTime); _circleDestroyer = new CirclesDestroyer(_activeCircles); _collisionsDetector = new CollisionsDetector(settings.NumUnitsToSpawn, size); }
public CirclesCollision(Circle c1, Circle c2, CirclesDestroyer destroyer) { _destroyer = destroyer; _c1 = c1; _c2 = c2; }