Esempio n. 1
0
    private void UpdateDelayRecycle()
    {
        int num = (int)(1000f * Time.deltaTime);
        LinkedListNode <stDelayRecycle> first = this.m_delayRecycle.First;

        while (first != null)
        {
            LinkedListNode <stDelayRecycle> node = first;
            first = node.Next;
            if (null == node.Value.recycleObj)
            {
                this.m_delayRecycle.Remove(node);
            }
            else
            {
                stDelayRecycle local1 = node.Value;
                local1.timeMillSecondsLeft -= num;
                if (node.Value.timeMillSecondsLeft <= 0)
                {
                    if (node.Value.callback != null)
                    {
                        node.Value.callback(node.Value.recycleObj);
                    }
                    this.RecycleGameObject(node.Value.recycleObj);
                    this.m_delayRecycle.Remove(node);
                }
            }
        }
    }
Esempio n. 2
0
    public void RecycleGameObjectDelay(GameObject pooledGameObject, int delayMillSeconds, OnDelayRecycleDelegate callback = null)
    {
        stDelayRecycle recycle = new stDelayRecycle {
            recycleObj          = pooledGameObject,
            timeMillSecondsLeft = delayMillSeconds,
            callback            = callback
        };

        this.m_delayRecycle.AddLast(recycle);
    }