Esempio n. 1
0
        /// <summary>
        /// 场景加载完成
        /// </summary>
        static void OnLoadSceneComplete(ResBase res)
        {
            if (SceneDesc.current == null)
            {
                return;
            }

            if (null != _sceneDesc)
            {
                Debug.LogErrorFormat("Load scene {0} repeat!", _sceneName);
                DestroyScene();
            }

            _sceneDesc = SceneDesc.current;
            ResManager.InitGrass(_sceneDesc.prefabs);

            if (null != _sceneDesc)
            {
                for (int i = 0; i < _sceneDesc.trees.Length; ++i)
                {
                    var tree = ObjectPool.New <SceneTree>();
                    tree.Init(_sceneDesc.trees[i]);
                    _trees.Add(tree);
                }

                // ResCollection
                _resCollection = ObjectPool.New <ResCollection>();
                _resCollection.Init(_sceneDesc.resCollection);
                _resCollection.LoadRes();
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 初始化
 /// </summary>
 public void Init(SceneTree tree, SceneTreeNodeObjectData data, int idxPrefab)
 {
     _tree      = tree;
     _data      = data;
     _idxPrefab = idxPrefab;
     if (_tree.data.objType == SceneTreeObjType.Renderer && !_data.lods[0].resCollection.isEmpty)
     {
         _resCollection = ObjectPool.New <ResCollection>();
         _resCollection.Init(_data.lods[0].resCollection);
     }
 }