示例#1
0
        protected virtual void Update()
        {
            // Decay the life of all delayed destruction calls
            for (int __i = delays.Count - 1; __i >= 0; __i--)
            {
                Delay __delay = delays[__i];

                __delay.life -= Time.deltaTime;

                // Skip to next one?
                if (__delay.life > 0.0f)
                {
                    continue;
                }

                // Remove and pool delay
                delays.RemoveAt(__i); ClassPool <Delay> .Despawn(__delay);

                // Finally despawn it after delay
                if (__delay.clone != null)
                {
                    Despawn(__delay.clone);
                }
                else
                {
                    CGDebug.LogWarning("Attempting to update the delayed destruction of a prefab clone that no longer exists, did you accidentally delete it?", this);
                }
            }
        }
示例#2
0
        public void DespawnAll()
        {
            // Merge
            MergeSpawnedClonesToList();

            // Despawn
            for (int __i = spawnedClones.Count - 1; __i >= 0; __i--)
            {
                GameObject __clone = spawnedClones[__i];

                if (__clone != null)
                {
                    DespawnNow(__clone);
                }
            }

            spawnedClones.Clear();

            // Clear all delays
            for (int __i = delays.Count - 1; __i >= 0; __i--)
            {
                ClassPool <Delay> .Despawn(delays[__i]);
            }

            delays.Clear();
        }