public void AddTile(enTileTypes tileType, Texture2D tileTexture)
 {
     if (tileTexture != null)
     {
         if (mTerrainTiles.Exists(curTile => curTile.TileType == tileType))
         {
             CTerrainTile oldTile = mTerrainTiles.Find(curTile => curTile.TileType == tileType);
             if (oldTile != null)
             {
                 oldTile = new CTerrainTile(tileType, tileTexture);
             }
         }
         else
         {
             mTerrainTiles.Add(new CTerrainTile(tileType, tileTexture));
         }
     }
 }
        float RegionPercent(enTileTypes tileType, ushort usHeight)
        {
            CTerrainTile tile = GetTile(tileType);

            if (tile == null)
            {
                Debug.LogError(string.Format("No tileType : Type:{0}|Height:{1}", tileType.ToString(), usHeight));
                return(0.0f);
            }

            CTerrainTile lowestTile  = GetTile(enTileTypes.lowest_tile);
            CTerrainTile lowTile     = GetTile(enTileTypes.low_tile);
            CTerrainTile highTile    = GetTile(enTileTypes.high_tile);
            CTerrainTile highestTile = GetTile(enTileTypes.highest_tile);

            //如果最低的块已经加载了,且落在它的low Height的块里面
            if (lowestTile != null)
            {
                if (tileType == enTileTypes.lowest_tile &&
                    IsHeightAllLocateInTile(tileType, usHeight))
                {
                    return(1.0f);
                }
            }

            else if (lowTile != null)
            {
                if (tileType == enTileTypes.low_tile &&
                    IsHeightAllLocateInTile(tileType, usHeight))
                {
                    return(1.0f);
                }
            }
            else if (highTile != null)
            {
                if (tileType == enTileTypes.high_tile &&
                    IsHeightAllLocateInTile(tileType, usHeight))
                {
                    return(1.0f);
                }
            }
            else if (highestTile != null)
            {
                if (tileType == enTileTypes.highest_tile &&
                    IsHeightAllLocateInTile(tileType, usHeight))
                {
                    return(1.0f);
                }
            }

            //以[,)左闭右开吧
            if (usHeight < tile.lowHeight || usHeight > tile.highHeight)
            {
                return(0.0f);
            }


            if (usHeight < tile.optimalHeight)
            {
                float fTemp1 = usHeight - tile.lowHeight;
                float fTemp2 = tile.optimalHeight - tile.lowHeight;

                //这段会产生小斑点,因为有些值可能会比较特殊
                //if (fTemp1 == 0.0f)
                //{
                //    Debug.LogError(string.Format("Lower than Optimal Height: Type:{0}|Height:{1}|fTemp1:{2}|lowHeight:{3}|optimalHeight:{4}", tileType.ToString(), usHeight, fTemp1, tile.lowHeight, tile.optimalHeight));
                //    return 1.0f;
                //}
                return(fTemp1 / fTemp2);
            }
            else if (usHeight == tile.optimalHeight)
            {
                return(1.0f);
            }
            else if (usHeight > tile.optimalHeight)
            {
                float fTemp1 = tile.highHeight - tile.optimalHeight;

                //这段会产生小斑点,因为有些值可能会比较特殊
                //if (((fTemp1 - (usHeight - tile.optimalHeight)) / fTemp1) == 0.0f)
                //{
                //    Debug.LogError(string.Format("Higher than Optimal Height: Type:{0}|Height:{1}|fTemp1:{2}|optimalHeight:{3}", tileType.ToString(), usHeight, fTemp1, tile.optimalHeight));
                //    return 1.0f;
                //}
                return((fTemp1 - (usHeight - tile.optimalHeight)) / fTemp1);
            }

            Debug.LogError(string.Format("Unknow: Type:{0}|Height:{1}", tileType.ToString(), usHeight));
            return(0.0f);
        }
        } //

        public CTerrainTile GetTile(enTileTypes tileType)
        {
            return(mTerrainTiles.Count > 0 ? mTerrainTiles.Find(curTile => curTile.TileType == tileType) : null);
        }