예제 #1
0
        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, 85f);
                    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);
                }
            }
        }