示例#1
0
    private void CreateChunk()
    {
        MapChunkMesh.Clear();
        ChunkVectors   = new List <Vector3>();
        ChunkTriangles = new List <int>();
        ChunkColors    = new List <Color>();

        for (int k = 0; k < ChunkTile.Count; k++)
        {
            if (BaseTiles.GetFloorType(ChunkTile[k]) == null)
            {
                continue;
            }
            Tile    TheTile = BaseTiles.GetTile(ChunkTile[k]);
            Vector3 center  = BaseTiles.TileLocation(ChunkTile[k]);
            if (BaseTiles.GetTile(ChunkTile[k]).solidType != null)
            {
                DrawSolid(center, TheTile.MySolidColor.Value, k);
            }
            else
            {
                Color?FloorColor = BaseTiles.GetFloorType(ChunkTile[k]).TileTypeColor;
                if (!FloorColor.HasValue)
                {
                    FloorColor = BaseTiles.GetTile(ChunkTile[k].Below).MySolidColor;
                    if (!FloorColor.HasValue)
                    {
                        continue; //this shouldnt come up but oh well
                    }
                }
                DrawFloor(center, FloorColor.Value, k);
            }
        }
        MapChunkMesh.vertices  = ChunkVectors.ToArray();
        MapChunkMesh.triangles = ChunkTriangles.ToArray();
        MapChunkMesh.colors    = ChunkColors.ToArray();
        MapChunkMesh.RecalculateNormals();
        ChunkCollider.sharedMesh = MapChunkMesh;
        dFlagChunk = false;
    }
 virtual public TileType GetFloorType(HexCoordinates coords)
 {
     return(BaseList.GetFloorType(coords));
 }