示例#1
0
    /// <summary>
    /// Check if a block set is done on the edge, meaning a mesh update has to happen to the corresponding neighbour
    /// </summary>
    /// <param name="x"></param>
    /// <param name="y"></param>
    /// <param name="z"></param>
    private void UpdateNeighbourChunksNecessary(int x, int y, int z)
    {
        if (x == 0)
        {
            ChunkColumn chunkCol = World.GetColumn(colCoord.GetRelativePos(-1, 0));

            if (chunkCol != null)
            {
                chunkCol.UpdateChunk(y / chunkSize);
            }
        }
        else if (x == chunkSize - 1)
        {
            ChunkColumn chunkCol = World.GetColumn(colCoord.GetRelativePos(1, 0));

            if (chunkCol != null)
            {
                chunkCol.UpdateChunk(y / chunkSize);
            }
        }

        if (y == 0)
        {
            UpdateChunk(y / chunkSize - 1);
        }
        else if (y == chunkSize - 1)
        {
            UpdateChunk(y / chunkSize + 1);
        }

        if (z == 0)
        {
            ChunkColumn chunkCol = World.GetColumn(colCoord.GetRelativePos(0, -1));

            if (chunkCol != null)
            {
                chunkCol.UpdateChunk(y / chunkSize);
            }
        }
        else if (z == chunkSize - 1)
        {
            ChunkColumn chunkCol = World.GetColumn(colCoord.GetRelativePos(0, 1));

            if (chunkCol != null)
            {
                chunkCol.UpdateChunk(y / chunkSize);
            }
        }
    }