Exemplo n.º 1
0
 private void Awake()
 {
     spriteRenderer    = GetComponent <SpriteRenderer>();
     recycleGameObject = GetComponent <RecycleGameObject>();
     start             = spriteRenderer.color;
     end = new Color(start.r, start.g, start.b, 0.0f);
 }
Exemplo n.º 2
0
        private static ObjectPool GetObjectPool(RecycleGameObject reference)
        {
            ObjectPool pool = null;

            if (pools.ContainsKey(reference))
            {
                pool = pools[reference];
            }
            else
            {
                var poolContainer = new GameObject(reference.gameObject.name + "ObjectPool");
                pool = poolContainer.AddComponent <ObjectPool>();
                pool.transform.SetParent(poolCollection.transform);
                pool.prefab = reference;
                pools.Add(reference, pool);
            }

            return(pool);
        }