Esempio n. 1
0
 private QuadTree(int x, int y, int width, int height, int maxDepth)
 {
     this.x = x;
     this.y = y;
     this.width = width;
     this.height = height;
     this.maxDepth = maxDepth;
     if (maxDepth > 0)
     {
         cells = new QuadTree[4];
         cells[0] = new QuadTree(0, 0, halfW, halfH, maxDepth - 1);
         cells[1] = new QuadTree(halfW, 0, halfW, halfH, maxDepth - 1);
         cells[2] = new QuadTree(halfW, halfH, halfW, halfH, maxDepth - 1);
         cells[3] = new QuadTree(0, halfH, halfW, halfH, maxDepth - 1);
     }
     objects = new List<Wall>();
 }
Esempio n. 2
0
 public QuadTree(int width, int height, int maxDepth)
 {
     x = 0;
     y = 0;
     this.width = width;
     this.height = height;
     this.maxDepth = maxDepth;
     halfH = height / 2;
     halfW = width / 2;
     if (maxDepth > 0)
     {
         cells = new QuadTree[4];
         cells[0] = new QuadTree(0, 0, halfW, halfH, maxDepth - 1);
         cells[1] = new QuadTree(halfW, 0, halfW, halfH, maxDepth - 1);
         cells[2] = new QuadTree(halfW, halfH, halfW, halfH, maxDepth - 1);
         cells[3] = new QuadTree(0, halfH, halfW, halfH, maxDepth - 1);
     }
     objects = new List<Wall>();
 }
Esempio n. 3
0
        public World()
        {
            streaker = new Streaker(new PhysicsComponent2D(new Vector2(-50, -50), 0, new Vector2(20, 20), Speeds.Streaker_Run, 1250, 150, 750, 8, 50, 0.25f, true),
                new DrawComponent(SpriteDatabase.GetAnimation("streaker_static"), Color.White, Vector2.Zero, new Vector2(.4f, .4f), .5f));

            npcs = new List<NPC>();
            moveableObjectsX = new List<EntityMoveable>();
            moveableObjectsY = new List<EntityMoveable>();

            moveableObjectsX.Add(streaker);
            moveableObjectsY.Add(streaker);

            qTree = new QuadTree((int)Map.WIDTH, (int)Map.HEIGHT, 3);
            map = new Map();
            smartFlock = new Flock(300);
            dumbFlock = new Flock(150);
            consumableSpawns = new List<ConsumableSpawnpoint>();
            updateSpawnData();
        }