Пример #1
0
        public void newWorld()
        {
            //reset();

            Chunk chunk;

            int numChunks = 50;

            for (int i = 0; i < numChunks; i++)
            {
                for (int j = 0; j < numChunks; j++)
                {
                    int iLoc = i - numChunks / 2;
                    int jLoc = j - numChunks / 2;
                    //create ground chunk
                    chunk = new Chunk(new Vector3(WorldParameters.theChunkSize * iLoc, -WorldParameters.theChunkSize, WorldParameters.theChunkSize * jLoc));
                    chunk.setNodeMaterial(new NodeKey(1), MaterialManager.getMaterialIndex("dirt"));
                    addChunk(chunk);
                    myTerrainSource.chunkCache.updateChunk(chunk);

                    //create air chunk above it
                    chunk = new Chunk(new Vector3(-WorldParameters.theChunkSize * iLoc, 0, WorldParameters.theChunkSize * jLoc));
                    chunk.setNodeMaterial(new NodeKey(1), MaterialManager.getMaterialIndex("air"));
                    addChunk(chunk);
                    myTerrainSource.chunkCache.updateChunk(chunk);
                }
            }
        }
Пример #2
0
        public override bool execute(World w)
        {
            saveState(w, myLocation);
            if (myChunk != null)
            {
                UInt32 m = MaterialManager.getMaterialIndex(myMaterialName);
                myChunk.setNodeMaterial(myLocation.node, m);
                return(true);
            }

            return(false);
        }