예제 #1
0
        public void Reclaim(HeatmapParticle particle)
        {
            if (pool == null)
            {
                CreatePool();
            }

            pool.Add(particle);
            particle.Height = 0.01f;
            particle.gameObject.SetActive(false);
        }
예제 #2
0
 private void CreatePoolInEditor()
 {
     pool = new List <HeatmapParticle>();
     if (!Application.isEditor)
     {
         poolScene = SceneManager.GetSceneByName(name);
         if (poolScene.isLoaded)
         {
             GameObject[] rootObjects = poolScene.GetRootGameObjects();
             for (int i = 0; i < rootObjects.Length; i++)
             {
                 HeatmapParticle pooledShape = rootObjects[i].GetComponent <HeatmapParticle>();
                 if (!pooledShape.gameObject.activeSelf)
                 {
                     pool.Add(pooledShape);
                 }
             }
             return;
         }
     }
     poolScene      = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive);
     poolScene.name = name;
 }
예제 #3
0
        void CreatePool()
        {
            pool = new List <HeatmapParticle>();
#if UNITY_EDITOR
            if (Application.isEditor)
            {
                poolScene = SceneManager.GetSceneByName(name);
                if (poolScene.isLoaded)
                {
                    GameObject[] rootObjects = poolScene.GetRootGameObjects();
                    for (int i = 0; i < rootObjects.Length; i++)
                    {
                        HeatmapParticle pooledShape = rootObjects[i].GetComponent <HeatmapParticle>();
                        if (!pooledShape.gameObject.activeSelf)
                        {
                            pool.Add(pooledShape);
                        }
                    }
                    return;
                }
            }
#endif
            poolScene = SceneManager.CreateScene(name);
        }