示例#1
0
        public void LoadedTerrainData(Object obj, UnityObject asset)
        {
            --_loadingDataCount;

            var terrainName = asset.Address.AssetName;
            var data        = asset.As <TextAsset>();

            if (data == null)
            {
                if (_cachedTerrain.ContainsKey(terrainName))
                {
                    var terrainData = _cachedTerrain[terrainName].terrainData;
                    var heightMap   = terrainData.GetHeights(0, 0, terrainData.heightmapResolution,
                                                             terrainData.heightmapResolution);

                    if (!_detailManager.TerrainLoaded(_cachedTerrain[terrainName], _cachedDetailDist[terrainName],
                                                      _minPosMap[terrainName], heightMap))
                    {
                        logger.ErrorFormat("{0} will not have grass", terrainName);
                    }

//                    if (!_treeManager.TerrainLoaded(_cachedTerrain[terrainName], _cachedTreeDist[terrainName],
//                        _minPosMap[terrainName], heightMap))
//                        logger.ErrorFormat("{0} will not have tree", terrainName);
                }
                else
                {
                    logger.ErrorFormat("wrong loaded terraindata name: {0}", terrainName);
                }
            }
            else
            {
                if (_cachedTerrain.ContainsKey(terrainName))
                {
                    if (!_detailManager.TerrainLoaded(data, _cachedTerrain[terrainName], _cachedDetailDist[terrainName],
                                                      _minPosMap[terrainName]))
                    {
                        logger.ErrorFormat("{0} will not have grass", terrainName);
                    }

//                    if (!_treeManager.TerrainLoaded(data, _cachedTerrain[terrainName], _cachedTreeDist[terrainName],
//                        _minPosMap[terrainName]))
//                        logger.ErrorFormat("{0} will not have tree", terrainName);
                }
            }
        }
示例#2
0
        public void LoadedTerrainData(Object obj, UnityObject asset)
        {
            --_loadingDataCount;

            var terrainName = asset.Address.AssetName;
            var data        = asset.As <TextAsset>();

            if (data == null)
            {
                if (_cachedTerrain.ContainsKey(terrainName))
                {
                    try
                    {
                        if (!_detailManager.TerrainLoaded(_cachedTerrain[terrainName], _cachedDetailDist[terrainName]))
                        {
                            logger.ErrorFormat("unmatch parameter in {0}", terrainName);
                        }
                    }
                    catch (Exception e)
                    {
                        logger.Error(terrainName + "\n" + e.Message + "\n" + e.StackTrace);
                        throw e;
                    }
                }
                else
                {
                    logger.ErrorFormat("wrong loaded terraindata name: {0}", terrainName);
                }
            }
            else
            {
                if (_cachedTerrain.ContainsKey(terrainName))
                {
                    if (!_detailManager.TerrainLoaded(data, _cachedTerrain[terrainName], _cachedDetailDist[terrainName]))
                    {
                        logger.ErrorFormat("unmatch parameter in {0}", terrainName);
                    }
                }
            }
        }