Ejemplo n.º 1
0
        public void Release(TileIndex rTileIndex)
        {
            if (mBlockBuffers == null)
            {
                return;
            }

            SceneTileWrapper rSceneTileWrapper = mBlockBuffers.Find((rItem) => { return(rItem.curIndex.Equals(rTileIndex)); });

            if (rSceneTileWrapper != null)
            {
                rSceneTileWrapper.Release();
                Debug.Log("删除块: " + rTileIndex.ToString());
                mBlockBuffers.Remove(rSceneTileWrapper);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 创建一个SceneTileWrapper
        /// </summary>
        public SceneTileWrapper Alloc(TileIndex rTileIndex, SceneTile rSceneTile, TerrainData rTerrainData)
        {
            Debug.Log("加载块: " + rTileIndex.ToString());

            var rSceneTileWrapper = new SceneTileWrapper();

            rSceneTileWrapper.curIndex = new TileIndex(rTileIndex);
            if (rSceneTile != null && rTerrainData != null)
            {
                rSceneTileWrapper.tileGo                    = Terrain.CreateTerrainGameObject(rTerrainData);
                rSceneTileWrapper.tileGo.name               = string.Format("tile_{0}_{1}", rTileIndex.Row, rTileIndex.Col);
                rSceneTileWrapper.tileGo.transform.parent   = mMultiSceneRootGo.transform;
                rSceneTileWrapper.tileGo.transform.position = new Vector3(rSceneTile.Offset.x, 0, rSceneTile.Offset.y);
                rSceneTileWrapper.sceneTile                 = rSceneTile;
            }
            mBlockBuffers.Add(rSceneTileWrapper);
            return(rSceneTileWrapper);
        }