Exemplo n.º 1
0
 private void OnDisable()
 {
     if (hasPool)
     {
         poolGroup.Despawn(this.gameObject);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Despawns the specified object.
        /// </summary>
        /// <param name="poolObjectId">The object to despawn.</param>
        public void Despawn(int poolObjectId)
        {
            if (!PoolDictionary.ContainsKey(poolObjectId))
            {
                Debug.LogWarning(String.Format("The object ID '{0}' passed to Despawn is not in the FeatherPool. Not despawning.", poolObjectId));
                return;
            }

            // Fetch PoolData containing FeatherPool and FeatherPoolGroup
            FeatherPool featherPool = PoolDictionary[poolObjectId];

            // Despawn object
            featherPool.Despawn(poolObjectId);

            //FeatherLogManager.LogNotice(Instance.gameObject, String.Format("FeatherPool despawned '{0}' at {1}", itemName, Time.time), poolObject.gameObject);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Despawns the specified object.
        /// </summary>
        /// <param name="poolObject">The object to despawn.</param>
        public void Despawn(GameObject poolObject)
        {
            if (poolObject == null)
            {
                Debug.LogWarning("No Transform passed to Despawn method.");
                return;
            }

            FeatherPool featherPool = null;

            NamedPoolDictionary.TryGetValue(poolObject.name, out featherPool);

            if (featherPool == null)
            {
                Debug.LogWarning(String.Format("The Transform '{0}' passed to Despawn is not in the FeatherPool. Not despawning.", poolObject.name));
                return;
            }

            // Despawn object
            featherPool.Despawn(poolObject);

            //FeatherLogManager.LogNotice(Instance.gameObject, String.Format("FeatherPool despawned '{0}' at {1}", itemName, Time.time), poolObject.gameObject);
        }