Ejemplo n.º 1
0
        public Chunk(PlanetChunks handler, BoundingBox bounds, int depth, int id, GameObject parent, Chunk parentChunk, string name)
        {
            this.parentChunk = parentChunk;
            this.handler     = handler;
            this.bounds      = bounds;
            this.cells       = new Chunk[4];
            this.depth       = depth;
            this.name        = name;
            this.subdivided  = false;

            this.generateMesh(id, parent);
        }
Ejemplo n.º 2
0
    private void generate()
    {
        // Initialize planet chunks
        foreach (Transform child in transform)
        {
            GameObject.Destroy(child.gameObject);
        }

        chunksContainer = new GameObject("Planet Chunks");
        chunksContainer.transform.parent = transform;


        planetChunks[0] = new PlanetChunks(this, gameObject.transform.position, "upX", chunksContainer);
        planetChunks[1] = new PlanetChunks(this, gameObject.transform.position, "downX", chunksContainer);
        planetChunks[2] = new PlanetChunks(this, gameObject.transform.position, "upY", chunksContainer);
        planetChunks[3] = new PlanetChunks(this, gameObject.transform.position, "downY", chunksContainer);
        planetChunks[4] = new PlanetChunks(this, gameObject.transform.position, "upZ", chunksContainer);
        planetChunks[5] = new PlanetChunks(this, gameObject.transform.position, "downZ", chunksContainer);
    }