Exemple #1
0
 public void Dispose()
 {
     Debug.Log("Dispose Destructible....");
     DamageablePoolHandler.RemoveFromPool(this);
     transform.DetachChildren();
     Destroy(this.gameobject); //TODO Add to available destructibles Pool
 }
Exemple #2
0
 public void GeneratePool()
 {
     currentSize = 0;
     for (int j = 0; j < startCount; j++)
     {
         freshInstance = FactoryRequest();
         DamageablePoolHandler.AddToPool(freshInstance as IDamageable);
     }
 }
Exemple #3
0
        public ICharacter RemoveFromPool(ICharacter character = null)
        {
            if (pool.Count > 0)
            {
                pointer = pool.First();
                pool.Remove(pointer.Key);
                currentSize = pool.Count;
                pointer.Value.Activate();
                return(pointer.Value);
            }
            freshInstance = FactoryRequest();
            freshInstance.Activate();
            DamageablePoolHandler.AddToPool(freshInstance as IDamageable);

            // Debug.LogWarning("Created NEW: " + freshInstance + " with InstanceID: " + freshInstance.GetInstanceID().ToString() + " for pool: " + this);
            return(freshInstance);
        }
Exemple #4
0
 private void Awake()
 {
     gameobject = gameObject;
     health.Initialize(maxHealth, this);
     DamageablePoolHandler.AddToPool(this);
 }