public void Visit(IQuadTree aQuadTree)
        {
            IUserObject insertedUserObject = this.insertedPoint.GetUserObject();
            IShape      insertedShape      = insertedUserObject.GetShape();
            IRectangle  targetBoundary     = CalculateTargetBoundary(insertedShape);

            if (null != aQuadTree.GetRootPoints())
            {
                List <IPoint <IUserObject> > pointsToBeDeleted = new List <IPoint <IUserObject> > ();
                foreach (IPoint <IUserObject> currentPoint in aQuadTree.GetRootPoints())
                {
                    Visit(currentPoint);
                    if (currentPoint.GetUserObject().GetHealth() < 1)
                    {
                        pointsToBeDeleted.Add(currentPoint);
                        this.userObjectSpawner.PushBackDeadObject(currentPoint.GetUserObject());
                    }
                    if (insertedUserObject.GetHealth() < 1)
                    {
                        this.userObjectSpawner.PushBackDeadObject(insertedUserObject);
                        break;
                    }
                }
                aQuadTree.RemovePointsFromRoot(pointsToBeDeleted);
            }
        }
Пример #2
0
 public void Visit(IQuadTree aQuadTree)
 {
     DrawBoundary(aQuadTree.GetBoundary());
     DrawPoints(aQuadTree.GetRootPoints());
 }