コード例 #1
0
                void GetBlockColor(EVoxelBlockType blocktype, int x, int y, int z, out Color32 color)
                {
                    color = _tables.blockColors[(int)blocktype - 1];

                    if ((x & 1) != 0)
                    {
                        Color cc = color;
                        cc   *= 0.9f;
                        cc.a  = 1f;
                        color = cc;
                    }
                    if ((z & 1) != 0)
                    {
                        Color cc = color;
                        cc   *= 0.9f;
                        cc.a  = 1f;
                        color = cc;
                    }
                    if ((y & 1) != 0)
                    {
                        Color cc = color;
                        cc   *= 0.9f;
                        cc.a  = 1f;
                        color = cc;
                    }
                }
コード例 #2
0
 void GetBlockColorAndSmoothing(EVoxelBlockType blocktype, out Color32 color, out uint smg, out float smoothing, out int layer)
 {
     color     = _tables.blockColors[(int)blocktype - 1];
     smg       = _tables.blockSmoothingGroups[(int)blocktype - 1];
     smoothing = _tables.blockSmoothingFactors[(int)blocktype - 1];
     layer     = GetBlockLayer(blocktype);
 }
コード例 #3
0
 public static bool IsCapBlock(EVoxelBlockType type)
 {
     if (type == EVoxelBlockType.Snow)
     {
         return(true);
     }
     return(false);
 }
コード例 #4
0
 public static bool IsDiggable(EVoxelBlockType type)
 {
     if (type == EVoxelBlockType.Water)
     {
         return(false);
     }
     return(true);
 }
コード例 #5
0
    public static int GetBlockLayer(EVoxelBlockType blocktype)
    {
        if (blocktype == EVoxelBlockType.Water)
        {
            return(EChunkLayers.Water.ToIndex());
        }
        else if ((blocktype == EVoxelBlockType.Leaves) || (blocktype == EVoxelBlockType.Needles) || (blocktype == EVoxelBlockType.Wood))
        {
            return(EChunkLayers.Trees.ToIndex());
        }

        return(EChunkLayers.Terrain.ToIndex());
    }
コード例 #6
0
 public static bool IsSolidBlock(EVoxelBlockType type)
 {
     if (type == EVoxelBlockType.Water ||
         type == EVoxelBlockType.Air ||
         type == EVoxelBlockType.Snow ||
         type == EVoxelBlockType.Flowers1 ||
         type == EVoxelBlockType.Flowers2 ||
         type == EVoxelBlockType.Flowers3 ||
         type == EVoxelBlockType.Flowers4)
     {
         return(false);
     }
     return(true);
 }
コード例 #7
0
 public static bool IsTransparentBlock(EVoxelBlockType type)
 {
     if (type == EVoxelBlockType.Air ||
         type == EVoxelBlockType.Water ||
         type == EVoxelBlockType.Needles ||
         type == EVoxelBlockType.Flowers1 ||
         type == EVoxelBlockType.Flowers2 ||
         type == EVoxelBlockType.Flowers3 ||
         type == EVoxelBlockType.Flowers4 ||
         type == EVoxelBlockType.Leaves ||
         type == EVoxelBlockType.Snow)
     {
         return(true);
     }
     return(false);
 }
コード例 #8
0
 public void GetElevationAndTopBlock(int x, int z, out int elevation, out EVoxelBlockType blockType)
 {
     elevation = 0;
     blockType = EVoxelBlockType.Grass;
 }
コード例 #9
0
 public WorldData.TerrainType GetTerrainData(EVoxelBlockType block)
 {
     return(data.terrainTypes[blockMapping[block]]);
 }
コード例 #10
0
 public static Voxel_t WithFlags(this EVoxelBlockType type, EVoxelBlockFlags flags = 0)
 {
     return(new Voxel_t(type, flags));
 }
コード例 #11
0
 public Voxel_t(EVoxelBlockType type, EVoxelBlockFlags flags)
 {
     raw = (byte)((int)type | (int)flags);
 }
コード例 #12
0
 public Voxel_t(EVoxelBlockType type)
 {
     raw = (byte)type;
 }