예제 #1
0
        /// <summary>
        /// Release all currently spawned objects based on given type.
        /// </summary>
        public void ReleaseAllByType(string type)
        {
            FactoryData factory;

            if (mFactory.TryGetValue(type, out factory))
            {
                for (int i = 0; i < factory.actives.Count; i++)
                {
                    PoolDataController pdc = factory.actives[i];

                    if (despawnCallback != null)
                    {
                        despawnCallback(pdc);
                    }

                    pdc.Despawn();

                    factory.ReleaseIgnoreActiveList(pdc);
                }

                factory.actives.Clear();
            }
            else
            {
                Debug.LogWarning("Unable to find type: " + type);
            }
        }
예제 #2
0
        public void Release(PoolDataController pdc)
        {
            if (pdc.claimed) //already claimed
            {
                return;
            }

            FactoryData dat;

            if (mFactory.TryGetValue(pdc.factoryKey, out dat))
            {
                if (despawnCallback != null)
                {
                    despawnCallback(pdc);
                }

                pdc.Despawn();

                dat.Release(pdc);
            }
            else
            {
                Debug.LogWarning("Unable to find type: " + pdc.factoryKey + " in " + group + ", failed to release.");
            }
        }
예제 #3
0
        public void Release(PoolDataController pdc)
        {
            pdc.Despawn();

            FactoryData dat;

            if (mFactory.TryGetValue(pdc.factoryKey, out dat))
            {
                dat.Release(pdc);
            }
            else
            {
                Debug.LogWarning("Unable to find type: " + pdc.factoryKey + " in " + group + ", failed to release.");
            }
        }
예제 #4
0
        /// <summary>
        /// Releases all currently spawned objects of all types.
        /// </summary>
        public void ReleaseAll()
        {
            foreach (KeyValuePair <string, FactoryData> itm in mFactory)
            {
                FactoryData factory = itm.Value;

                for (int i = 0; i < factory.actives.Count; i++)
                {
                    PoolDataController pdc = factory.actives[i];

                    pdc.Despawn();

                    factory.Release(pdc, false);
                }

                factory.actives.Clear();
            }
        }
예제 #5
0
        /// <summary>
        /// Release all currently spawned objects based on given type.
        /// </summary>
        public void ReleaseAllByType(string type)
        {
            FactoryData factory;

            if (mFactory.TryGetValue(type, out factory))
            {
                for (int i = 0; i < factory.actives.Count; i++)
                {
                    PoolDataController pdc = factory.actives[i];

                    pdc.Despawn();

                    factory.Release(pdc, false);
                }

                factory.actives.Clear();
            }
            else
            {
                Debug.LogWarning("Unable to find type: " + type);
            }
        }
예제 #6
0
        /// <summary>
        /// Releases all currently spawned objects of all types.
        /// </summary>
        public void ReleaseAll()
        {
            foreach (KeyValuePair <string, FactoryData> itm in mFactory)
            {
                FactoryData factory = itm.Value;

                for (int i = 0; i < factory.actives.Count; i++)
                {
                    PoolDataController pdc = factory.actives[i];

                    if (despawnCallback != null)
                    {
                        despawnCallback(pdc);
                    }

                    pdc.Despawn();

                    factory.ReleaseIgnoreActiveList(pdc);
                }

                factory.actives.Clear();
            }
        }