Exemplo n.º 1
0
        public void Update(float deltaTime)
        {
            if (!started)
            {
                return;
            }
            foreach (var circle in circles)
            {
                circle.UpdatePosition(deltaTime);
            }
            var collisionPairs = fieldWithCells.FindOverlaps(circles);

            foreach (Pair <CircleData> collided in collisionPairs)
            {
                CollideCircles(collided);
            }
            var deadCircles = new List <CircleData>();

            foreach (var circle in circles)
            {
                if (circle.GetRadius() > destroyRadius)
                {
                    CheckCollisionWithWalls(circle, deltaTime);
                }
                else
                {
                    deadCircles.Add(circle);
                    circle.Kill();
                }
            }
        }