/// <summary>
 /// 오브젝트가 생성됨.
 /// </summary>
 public T Created <T> (string poolingPath) where T : PoolingComponent
 {
     gameObject.SetActive(true);
     _poolingInfo = new PoolingInfo(poolingPath);
     OnCreated();
     return(GetCachedComponent <T> ());
 }
 /// <summary>
 /// 오브젝트가 생성됨.
 /// </summary>
 public T Created <T> (Transform parents, string poolingPath) where T : PoolingComponent
 {
     transform.SetParent(parents);
     gameObject.SetActive(true);
     _poolingInfo = new PoolingInfo(poolingPath);
     OnCreated();
     return(GetCachedComponent <T> ());
 }
Esempio n. 3
0
        /// <summary>
        /// 오브젝트를 파괴하지 않고 풀링함.
        /// 풀링된 오브젝트는 하위에 위치 시킴.
        /// </summary>
        public void RegistPooledObject(PoolingInfo poolingInfo, PoolingComponent poolingComponent)
        {
            if (_pooledPrefabs.ContainsKey(poolingInfo.PoolingPath) == false)
            {
                _pooledPrefabs.Add(poolingInfo.PoolingPath, new Queue <PoolingComponent> ());
            }

            _pooledPrefabs[poolingInfo.PoolingPath].Enqueue(poolingComponent);

            if (_pooledObjTransformDict.ContainsKey(poolingInfo.PoolingPath) == false)
            {
                var gameObj      = new GameObject();
                var objTransform = gameObj.transform;
                objTransform.name = poolingInfo.PoolingPath;
                objTransform.SetParent(_objectPoolingComponent.transform);
                objTransform.SetInstantiateTransform();

                _pooledObjTransformDict.Add(poolingInfo.PoolingPath, objTransform);
            }

            poolingComponent.transform.SetParent(_pooledObjTransformDict[poolingInfo.PoolingPath]);
            poolingComponent.gameObject.SetActive(false);
        }
 /// <summary>
 /// 오브젝트가 생성됨.
 /// </summary>
 public void Created(string poolingPath)
 {
     gameObject.SetActive(true);
     _poolingInfo = new PoolingInfo(poolingPath);
     OnCreated();
 }