public void init(int chunkSize, int actualChunkX, int actualChunkZ, bool generateColumnsPerFrame = false)
    {
        tallestPoint = 0;
        solid = new BlockData(BlockData.BlockType.stone, new Vector3(),20);

        this.chunkSize = chunkSize;
        actualChunkCoords = new ChunkPos(actualChunkX, actualChunkZ);
        filter = gameObject.GetComponent<MeshFilter>();
        collider = gameObject.GetComponent<MeshCollider>();

        WG = GetComponentInParent<WorldGenerator>();

        bool loaded = WorldSaver.LoadChunk(this);
        if (!loaded)
        {

            Blocks = new BlockData[chunkSize, airLimit, chunkSize];

            //fill the entire array of blocks with air
            for (int x = 0; x < chunkSize; x++)
            {

                for (int y = 0; y < airLimit; y++)
                {
                    for (int z = 0; z < chunkSize; z++)
                    {
                        Blocks[x, y, z] = new BlockData(BlockData.BlockType.air, new Vector3((actualChunkX + x), y, (actualChunkZ + z)),20);
                    }
                }
            }
            CalculateChunk(actualChunkX, actualChunkZ);
        }
    }
Esempio n. 2
0
 public ShipModel()
 {
     shipSize = new IntVector3(GameConstants.maxShipDimension, GameConstants.maxShipDimension, GameConstants.maxShipDimension);
     blockDatas = new BlockData[shipSize.x, shipSize.y, shipSize.z];
     shipInfo = new ShipInfo(this);
 }