Beispiel #1
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         if (sb)
         {
             StartCoroutine(SceneStreaming.Combine(parentStreamer, streamers));
         }
         else
         {
             StartCoroutine(SceneStreaming.Separate(parentStreamer, streamers));
         }
         sb = !sb;
     }
 }
Beispiel #2
0
        private IEnumerator Loader()
        {
            while (enabled)
            {
                LoadCommand cmd;
                if (allLoadingCommand.TryDequeue(out cmd))
                {
                    switch (cmd.ope)
                    {
                    case LoadCommand.Operator.Combine:
                        childrenList.Clear();
                        if (allGPURPScene[cmd.leftDownSon])
                        {
                            childrenList.Add(allGPURPScene[cmd.leftDownSon]);
                        }
                        if (allGPURPScene[cmd.leftUpSon])
                        {
                            childrenList.Add(allGPURPScene[cmd.leftUpSon]);
                        }
                        if (allGPURPScene[cmd.rightDownSon])
                        {
                            childrenList.Add(allGPURPScene[cmd.rightDownSon]);
                        }
                        if (allGPURPScene[cmd.rightUpSon])
                        {
                            childrenList.Add(allGPURPScene[cmd.rightUpSon]);
                        }
                        yield return(SceneStreaming.Combine(allGPURPScene[cmd.parent], childrenList));

                        break;

                    case LoadCommand.Operator.Disable:
                        yield return(allGPURPScene[cmd.parent].Delete());

                        break;

                    case LoadCommand.Operator.Enable:
                        yield return(allGPURPScene[cmd.parent].Generate());

                        break;

                    case LoadCommand.Operator.Separate:
                        childrenList.Clear();
                        if (allGPURPScene[cmd.leftDownSon])
                        {
                            childrenList.Add(allGPURPScene[cmd.leftDownSon]);
                        }
                        if (allGPURPScene[cmd.leftUpSon])
                        {
                            childrenList.Add(allGPURPScene[cmd.leftUpSon]);
                        }
                        if (allGPURPScene[cmd.rightDownSon])
                        {
                            childrenList.Add(allGPURPScene[cmd.rightDownSon]);
                        }
                        if (allGPURPScene[cmd.rightUpSon])
                        {
                            childrenList.Add(allGPURPScene[cmd.rightUpSon]);
                        }
                        yield return(SceneStreaming.Separate(allGPURPScene[cmd.parent], childrenList));

                        break;
                    }
                }
                else
                {
                    yield return(null);
                }
            }
        }