private GameObjectCollector CreatePoolInternal(string location, int capacity)
        {
            GameObjectCollector pool = new GameObjectCollector(_root.transform, location, capacity);

            _collectors.Add(location, pool);
            return(pool);
        }
        private GameObjectCollector CreatePoolInternal(string location, bool dontDestroy, int initCapacity, int maxCapacity, float destroyTime)
        {
            GameObjectCollector pool = new GameObjectCollector(_root.transform, location, dontDestroy, initCapacity, maxCapacity, destroyTime);

            _collectors.Add(location, pool);
            return(pool);
        }
 /// <summary>
 /// 获取游戏对象
 /// </summary>
 public SpawnGameObject Spawn(string location)
 {
     if (_collectors.ContainsKey(location))
     {
         return(_collectors[location].Spawn());
     }
     else
     {
         // 如果不存在创建游戏对象池
         GameObjectCollector pool = CreatePoolInternal(location, 0);
         return(pool.Spawn());
     }
 }
 /// <summary>
 /// 获取游戏对象
 /// </summary>
 /// <param name="location">资源定位地址</param>
 /// <param name="forceClone">强制克隆游戏对象,忽略缓存池里的对象</param>
 /// <param name="userData">用户自定义数据</param>
 public SpawnGameObject Spawn(string location, bool forceClone = false, params System.Object[] userDatas)
 {
     if (_collectors.ContainsKey(location))
     {
         return(_collectors[location].Spawn(forceClone, userDatas));
     }
     else
     {
         // 如果不存在创建游戏对象池
         GameObjectCollector pool = CreatePoolInternal(location, false, _defaultInitCapacity, _defaultMaxCapacity, _defaultDestroyTime);
         return(pool.Spawn(forceClone, userDatas));
     }
 }
예제 #5
0
 internal SpawnGameObject(GameObjectCollector collector, GameObject go, params System.Object[] userDatas)
 {
     _cacheCollector = collector;
     Go        = go;
     UserDatas = userDatas;
 }
 internal SpawnGameObject(GameObjectCollector collector, GameObject go)
 {
     _cacheCollector = collector;
     Go = go;
 }
 internal SpawnGameObject(GameObjectCollector collector)
 {
     _cacheCollector = collector;
 }