예제 #1
0
    public void CreateChunk(int x, int y, int z)
    {
        WorldPos worldPos = new WorldPos(x, y, z);

        //Instantiate the at the coordiantes using the prefab
        GameObject newChunkObject = Instantiate(chunkPrefab, new Vector3(x, y, z), Quaternion.Euler(Vector3.zero)) as GameObject;
        Chunk      newChunk       = newChunkObject.GetComponent <Chunk>();

        newChunk.pos   = worldPos;
        newChunk.world = this;

        //Add it to the chunks dictioanry with the position as key
        chunks.Add(worldPos, newChunk);

        TerrainGen terrainGen = new TerrainGen();

        terrainGen.SetOrigin(origin);
        terrainGen.SetWorld(this);
        //List<string> companies = new List<string>();
        ////TODO Give company names to terrain gen
        //companies.Add("Apple");
        //companies.Add("Alphabet");
        //companies.Add("Amazon");
        //companies.Add("Yahoo");
        //companies.Add("Twitter");
        terrainGen.SetCompanies(companies);



        newChunk = terrainGen.ChunkGen(newChunk);
        newChunk.SetBlocksUnmodified();
        Serialization.Load(newChunk);
    }