Ejemplo n.º 1
0
 //Extension
 public static void Pool <T>(this T _instance, string _poolName = null) where T : class
 {
     PoolsOfType <T> .GetPool(_poolName).Push(_instance);
 }
Ejemplo n.º 2
0
 public static T Pop <T>(string _poolName = null) where T : class
 {
     return(PoolsOfType <T> .GetPool(_poolName).Pop());
 }
Ejemplo n.º 3
0
 public static Pool <T> GetPool <T>(string _name = null) where T : class
 {
     return(PoolsOfType <T> .GetPool(_name));
 }
Ejemplo n.º 4
0
 // Extension method as a shorthand for Push function
 public static void Pool <T>(this T obj, string poolName = null) where T : class
 {
     PoolsOfType <T> .GetPool(poolName).Push(obj);
 }
Ejemplo n.º 5
0
    // NOTE: if you don't need two or more pools of same type,
    // leave poolName as null while calling any of these functions
    // for better performance

    public static SimplePool <T> GetPool <T>(string poolName = null) where T : class
    {
        return(PoolsOfType <T> .GetPool(poolName));
    }
Ejemplo n.º 6
0
 public static bool HasPool <T>(string poolName = null) where T : class
 {
     return(PoolsOfType <T> .HasPool(poolName));
 }