示例#1
0
        public void Clear()
        {
            _timer.Close();
            _activeCircles.Clear();

            _collisionsDetector = null;

            _circleSpawner   = null;
            _circleDestroyer = null;

            GC.Collect();
        }
示例#2
0
        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);
        }
示例#3
0
 public CirclesCollision(Circle c1, Circle c2, CirclesDestroyer destroyer)
 {
     _destroyer = destroyer;
     _c1        = c1;
     _c2        = c2;
 }