public void Dispose() { Debug.Log("Dispose Destructible...."); DamageablePoolHandler.RemoveFromPool(this); transform.DetachChildren(); Destroy(this.gameobject); //TODO Add to available destructibles Pool }
public void GeneratePool() { currentSize = 0; for (int j = 0; j < startCount; j++) { freshInstance = FactoryRequest(); DamageablePoolHandler.AddToPool(freshInstance as IDamageable); } }
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); }
private void Awake() { gameobject = gameObject; health.Initialize(maxHealth, this); DamageablePoolHandler.AddToPool(this); }