예제 #1
0
        public void SetHeight(int x, int z, float h)
        {
            VertexInfo v = GetVertex(x, z);

            if (v != null)
            {
                v.height = h;
            }
            else
            {
                Debug.LogError("set  height x :" + x + " z :" + z + "falid");
            }
        }
예제 #2
0
        public float GetHeight(int x, int z)
        {
            VertexInfo v = GetVertex(x, z);

            if (v != null)
            {
                return(v.height);
            }
            else
            {
                Debug.LogError("set  height x :" + x + " z :" + z + "falid");
            }

            return(0);
        }
예제 #3
0
        public LayerData(BaseLayer.LayerType type, uint blockNumX, uint blockNumZ)
        {
            layerType = type;

            BlockNumX = blockNumX;
            BlockNumZ = blockNumZ;

            GridX = TerrainBlock.GRID_NUM * blockNumX;
            GridZ = TerrainBlock.GRID_NUM * blockNumZ;

            VertexCountX = GridX + 1;
            VertexCountZ = GridZ + 1;

            m_uTotalBlock = blockNumX * blockNumZ;

            //Debug.Log(BlockNumX + " " + BlockNumZ);
            //Debug.Log(VertexCountX + " " + VertexCountZ);

            m_TerrainVertices = new VertexInfo[VertexCountX * VertexCountZ];
            for (int z = 0; z < VertexCountZ; z++)
            {
                for (int x = 0; x < VertexCountX; x++)
                {
                    VertexInfo pTemp = new VertexInfo();
                    int        index = x + (int)VertexCountX * z;
                    pTemp.x                  = x * TerrainBlock.GRID_LEN;
                    pTemp.z                  = z * TerrainBlock.GRID_LEN;
                    pTemp.height             = 0;
                    m_TerrainVertices[index] = pTemp;
                }
            }

            m_TerranGrids = new GridInfo[(GridX) * (GridZ)];
            for (int z = 0; z < GridZ; ++z)
            {
                for (int x = 0; x < GridX; ++x)
                {
                    GridInfo pTemp = new GridInfo();
                    int      index = x + (int)GridX * z;
                    pTemp.x              = x;
                    pTemp.z              = z;
                    pTemp.IsMask         = type == BaseLayer.LayerType.eLayerNormal ? true : false;
                    m_TerranGrids[index] = pTemp;
                }
            }
        }