示例#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);
        }