Ejemplo n.º 1
0
        /*
         * void OnTriggerEnter(Collider enteredCollider) {
         *  if (enteredCollider.CompareTag("Kill Zone")) {
         *      ReturnToPool();
         *  }
         * }
         */

        public T GetPooledInstance <T>() where T : PooledObject
        {
            if (!poolInstanceForPrefab)
            {
                poolInstanceForPrefab = ObjectPool.GetPool(this);
            }
            return((T)poolInstanceForPrefab.GetObject());
        }
Ejemplo n.º 2
0
        public static List <GameObject> GetOwnersObjectsOfType(int ownerId, string name)
        {
            var g = ObjectPool.GetPool(name, PoolType.Local).GetPlayerObjects(ownerId);

            g.AddRange(ObjectPool.GetPool(name, PoolType.PhotonView).GetPlayerObjects(ownerId));
            g.AddRange(ObjectPool.GetPool(name, PoolType.RPC).GetPlayerObjects(ownerId));
            return(g);
        }
Ejemplo n.º 3
0
        public static void Delete(GameObject g)
        {
            if (ObjectPool.objectPool.LogFull)
            {
                Debug.Log("Deleting " + g.name);
            }
            PoolToken token  = ObjectPool.GetPoolToken(g);
            Pool      myPool = ObjectPool.GetPool(token.poolPrefabString, token.poolType);

            myPool.StoreObject(g);
        }
Ejemplo n.º 4
0
        public static GameObject Instantiate(InstantiationData i)
        {
            if (ObjectPool.objectPool.LogFull)
            {
                Debug.Log("Instantiating " + i.PrefabPath);
            }
            Pool myPool = ObjectPool.GetPool(i.PrefabPath, i.PoolType);
            var  g      = myPool.GetObject(i);

            return(g);
        }