Beispiel #1
0
 public Patch(Node parentNode, GridTile tile)
 {
     this.tile = tile;
     this.parentNode = parentNode;
 }
        public override void GenPatches(GameObject parent,
                Vector2f origin,
                Vector2f center,
                int numChunks,
                int numEntityPerChunk,
                float parentSize)
        {
            float chunkSize = parentSize / ((float)numChunks);

            Vector2f max = new Vector2f((numChunks) * chunkSize);
            max.DivideStore(2);

            for (int x = 0; x < numChunks; x++)
            {
                for (int z = 0; z < numChunks; z++)
                {
                    Vector2f offset = new Vector2f(x * chunkSize, z * chunkSize);
                    Vector2f chunkLoc = origin.Add(offset).SubtractStore(max);
                    GridTile tile = new GridTile(chunkLoc, chunkSize, chunkSize, chunkLoc.x, chunkLoc.y, 50f);
                    Patch patch = new Patch( (Node)parent, tile);

                    patch.translation = new Vector3f(chunkLoc.x, 0, chunkLoc.y);
                    patch.chunkSize = chunkSize;
                    patch.entityPerChunk = numEntityPerChunk;

                    patches.Add(patch);
                }
            }
        }
Beispiel #3
0
 public Patch(Node parentNode, GridTile tile)
 {
     this.tile       = tile;
     this.parentNode = parentNode;
 }