Beispiel #1
0
    private void OnRunFinish(TweenPostion tp = null)
    {
        AllReset();

        if (tp != null)
        {
            tp.gameObject.SetActive(false);
            tp.resetPosition();
            tp.runFinish = null;
        }

        if (onExtraUp != null)
        {
            onExtraUp.Invoke(this, charaIdx, upRatio);
            onExtraUp = null;
        }

        if (onRecycle != null)
        {
            onRecycle.Invoke(this);
            onRecycle = null;
        }

        if (onRecycleDamage != null)
        {
            onRecycleDamage.Invoke(this, damageData, callbackTarget, tPos);
            onRecycleDamage = null;
        }
    }
Beispiel #2
0
 public virtual void Recycle(T obj)
 {
     if (_pooledObjs.Count < Capacity)
     {
         _pooledObjs.Enqueue(obj);
         OnRecycle?.Invoke(obj);
     }
     else
     {
         Destroy(obj);
     }
 }
Beispiel #3
0
    public void Recycle(IPoolObject <GameObject> poolObject)
    {
        if (poolObject.Pool != this)
        {
            return;
        }

        OnRecycle?.Invoke(poolObject.Content);
        if (TotalCount > MaxSize)
        {
            poolObject.Dispose();
        }
        else
        {
            objectsPoped.Remove(poolObject);
            objectsInPools.Add(poolObject);

            poolObject.Content.transform.SetParent(poolRoot.transform);
            poolObject.Content.SetActive(false);
        }
    }