コード例 #1
0
 public PoolSettings(PoolSettings src)
 {
     Prewarm    = src.Prewarm;
     AutoCreate = src.AutoCreate;
     MinItems   = src.MinItems;
     Threshold  = src.Threshold;
     Speed      = src.Speed;
     Debug      = src.Debug;
 }
コード例 #2
0
 public Pool(PoolSettings settings = null)
 {
     Settings   = settings ?? new PoolSettings();
     Identifier = typeof(T).FullName;
     mLastTime  = DTTime.TimeSinceStartup + UnityEngine.Random.Range(0, Settings.Speed);
     if (Settings.Prewarm)
     {
         Reset();
     }
 }
コード例 #3
0
ファイル: ComponentPool.cs プロジェクト: BoldBigflank/slotcar
 public void Initialize(System.Type type, PoolSettings settings)
 {
     m_Identifier = type.AssemblyQualifiedName;
     m_Settings   = settings;
     mLastTime    = DTTime.TimeSinceStartup + UnityEngine.Random.Range(0, Settings.Speed);
     if (Settings.Prewarm)
     {
         Reset();
     }
 }
コード例 #4
0
ファイル: PrefabPool.cs プロジェクト: ZhouJun2303/EG_SSS_2017
 public void Initialize(string ident, PoolSettings settings, params GameObject[] prefabs)
 {
     Identifier = ident;
     m_Settings = settings;
     Prefabs    = new List <GameObject>(prefabs);
     mLastTime  = DTTime.TimeSinceStartup + UnityEngine.Random.Range(0, Settings.Speed);
     if (Settings.Prewarm)
     {
         Reset();
     }
 }
コード例 #5
0
ファイル: PoolManager.cs プロジェクト: ATL3Y/Ded_Game
        public Pool <T> CreateTypePool <T>(PoolSettings settings = null)
        {
            PoolSettings s   = settings ?? new PoolSettings(DefaultSettings);
            IPool        res = null;

            if (!TypePools.TryGetValue(typeof(T), out res))
            {
                res = new Pool <T>(s);
                TypePools.Add(typeof(T), res);
            }
            return((Pool <T>)res);
        }
コード例 #6
0
ファイル: PoolManager.cs プロジェクト: ATL3Y/Ded_Game
        public ComponentPool CreateComponentPool <T>(PoolSettings settings = null) where T : Component
        {
            if (!IsInitialized)
            {
                Initialize();
            }
            PoolSettings s   = settings ?? new PoolSettings(DefaultSettings);
            IPool        res = null;

            if (!Pools.TryGetValue(typeof(T).AssemblyQualifiedName, out res))
            {
                res = gameObject.AddComponent <ComponentPool>();
                ((ComponentPool)res).Initialize(typeof(T), s);
                Pools.Add(res.Identifier, res);
            }
            return((ComponentPool)res);
        }
コード例 #7
0
ファイル: PoolManager.cs プロジェクト: ATL3Y/Ded_Game
        public PrefabPool CreatePrefabPool(string name, PoolSettings settings = null, params GameObject[] prefabs)
        {
            if (!IsInitialized)
            {
                Initialize();
            }
            PoolSettings s = settings ?? new PoolSettings(DefaultSettings);

            IPool pool = null;

            if (!Pools.TryGetValue(name, out pool))
            {
                PrefabPool p = gameObject.AddComponent <PrefabPool>();
                p.Initialize(name, s, prefabs);
                Pools.Add(name, p);
                return(p);
            }
            return((PrefabPool)pool);
        }