コード例 #1
0
 //Extension
 public static void Pool <T>(this T _instance, string _poolName = null) where T : class
 {
     PoolsOfType <T> .GetPool(_poolName).Push(_instance);
 }
コード例 #2
0
 public static T Pop <T>(string _poolName = null) where T : class
 {
     return(PoolsOfType <T> .GetPool(_poolName).Pop());
 }
コード例 #3
0
 public static Pool <T> GetPool <T>(string _name = null) where T : class
 {
     return(PoolsOfType <T> .GetPool(_name));
 }
コード例 #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);
 }
コード例 #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));
    }
コード例 #6
0
ファイル: SimplePoolUtils.cs プロジェクト: piotr-j/ggj2021
 public static bool HasPool <T>(string poolName = null) where T : class
 {
     return(PoolsOfType <T> .HasPool(poolName));
 }