Ejemplo n.º 1
0
        public void SceneLoaded(string sceneName,
                                int sceneIndex,
                                Scene scene,
                                StreamingScene sceneStruct,
                                Vector4 sceneDimension)
        {
            if (sceneIndex < 0)
            {
                return;
            }

            if (!_loadedGoes.ContainsKey(sceneIndex))
            {
                _loadedGoes.Add(sceneIndex, new List <UnityObject>());
                _sceneNameToId.Add(sceneName, sceneIndex);

                var count = sceneStruct.Objects.Count;
                for (int i = 0; i < count; i++)
                {
                    _streamingResourceHandler.LoadGo(sceneIndex, i);
                }

                var go = new GameObject("StreamingRoot");
                SceneManager.MoveGameObjectToScene(go, scene);
                _goRoot.Add(sceneIndex, go);
            }
        }
Ejemplo n.º 2
0
        public bool SetGoActivatiton(DistCullingCat cat, bool isActivated, IStreamingResourceHandler handler)
        {
            bool ret = false;

            if (cat == Cat)
            {
                switch (Status)
                {
                case StreamingGoStatus.NotLoaded:
                    if (isActivated)
                    {
                        handler.LoadGo(Key.SceneIndex, Key.GoIndex);
                        Status = StreamingGoStatus.Loading;
                    }

                    break;

                case StreamingGoStatus.Loading:
                    if (!isActivated)
                    {
                        Status = StreamingGoStatus.NotLoaded;
                    }

                    break;

                case StreamingGoStatus.Loaded:
                    if (!isActivated)
                    {
                        handler.UnloadGo(Go, Key.SceneIndex);

                        Status = StreamingGoStatus.NotLoaded;
                        RemoveHandlers();
                        Go  = null;
                        ret = true;
                    }

                    break;
                }
            }

            return(ret);
        }