Exemplo n.º 1
0
    public I Get(int x, int y, int z)
    {
        Vector3i    chunkPos = Chunk.ToChunkPosition(x, y, z);
        Vector3i    localPos = Chunk.ToLocalPosition(x, y, z);
        Chunk3D <I> chunk    = GetChunk(chunkPos);

        if (chunk != null)
        {
            return(chunk.Get(localPos));
        }
        return(defaultValue);
    }
Exemplo n.º 2
0
    public bool SetMaxLight(byte light, int x, int y, int z)
    {
        Vector3i       chunkPos = Chunk.ToChunkPosition(x, y, z);
        Vector3i       localPos = Chunk.ToLocalPosition(x, y, z);
        Chunk3D <byte> chunk    = lights.GetChunkInstance(chunkPos);
        byte           oldLight = chunk.Get(localPos);

        if (oldLight < light)
        {
            chunk.Set(light, localPos);
            return(true);
        }
        return(false);
    }
Exemplo n.º 3
0
        public byte GetLight(Vector3i chunkPos, Vector3i localPos, int worldY)
        {
            if (IsSunLight(chunkPos, localPos, worldY))
            {
                return(OCSunLightComputer.MAX_LIGHT);
            }

            Chunk3D <byte> chunk = lights.GetChunk(chunkPos);

            if (chunk != null)
            {
                byte light = chunk.Get(localPos);
                return((byte)Mathf.Max(OCSunLightComputer.MIN_LIGHT, light));
            }
            return(OCSunLightComputer.MIN_LIGHT);
        }