Ejemplo n.º 1
0
            public Enumerator(SpawnPool pool)
            {
                if (pool == null)
                {
                    throw new System.ArgumentNullException("pool");
                }

                _e = pool._registeredPrefabs.GetEnumerator();
            }
Ejemplo n.º 2
0
        protected override void Awake()
        {
            base.Awake();

            Pools.AddReference(this);
            if (this.CompareName(DEFAULT_SPAWNPOOL_NAME) && _defaultPool == null)
            {
                _defaultPool = this;
            }
        }
        protected override void Awake()
        {
            base.Awake();

            _pools.Add(this);
            if (this.name == DEFAULT_SPAWNPOOL_NAME && _defaultPool == null)
            {
                _defaultPool = this;
            }
        }
Ejemplo n.º 4
0
        protected override void OnDestroy()
        {
            base.OnDestroy();

            Pools.RemoveReference(this);
            if (Object.ReferenceEquals(this, _defaultPool))
            {
                _defaultPool = null;
            }
        }
Ejemplo n.º 5
0
        public static void CreatePrimaryPool()
        {
            if (PrimaryPoolExists)
            {
                return;
            }

            var go = new GameObject(DEFAULT_SPAWNPOOL_NAME);

            _defaultPool = go.AddComponent <SpawnPool>();
        }
Ejemplo n.º 6
0
        protected override void OnDestroy()
        {
            base.OnDestroy();

            if (object.ReferenceEquals(this, _defaultPool))
            {
                _defaultPool = null;
            }
            Pools.RemoveReference(this);

            var e = _registeredPrefabs.GetEnumerator();

            while (e.MoveNext())
            {
                e.Current.Clear();
            }
        }
Ejemplo n.º 7
0
 internal void DeInit()
 {
     _pool       = null;
     _prefab     = null;
     _sCacheName = null;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initialize with a reference to the pool that spawned this object. Include a cache name if this gameobject is cached, otherwise no cache name should be included.
 /// </summary>
 /// <param name="pool"></param>
 /// <param name="prefab">prefab this was spawned from</param>
 /// <param name="sCacheName"></param>
 internal void Init(SpawnPool pool, GameObject prefab, string sCacheName)
 {
     _pool       = pool;
     _prefab     = prefab;
     _sCacheName = sCacheName;
 }
Ejemplo n.º 9
0
 internal void Init(SpawnPool pool, GameObject prefab)
 {
     _pool       = pool;
     _prefab     = prefab;
     _sCacheName = null;
 }
Ejemplo n.º 10
0
 internal void Init(SpawnPool owner)
 {
     _owner = owner;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initialize with a reference to the pool that spawned this object. Include a cache name if this gameobject is cached, otherwise no cache name should be included.
 /// </summary>
 /// <param name="pool"></param>
 /// <param name="prefab">prefab this was spawned from</param>
 /// <param name="sCacheName"></param>
 internal void Init(SpawnPool pool, int prefabId, string sCacheName)
 {
     _pool       = pool;
     _prefabId   = prefabId;
     _sCacheName = sCacheName;
 }
Ejemplo n.º 12
0
 internal void Init(SpawnPool pool, int prefabId)
 {
     _pool       = pool;
     _prefabId   = prefabId;
     _sCacheName = null;
 }
Ejemplo n.º 13
0
 public void Init(SpawnPool owner)
 {
     _owner = owner;
 }
 /// <summary>
 /// Initialize with a reference to the pool that spawned this object. Include a cache name if this gameobject is cached, otherwise no cache name should be included.
 /// </summary>
 /// <param name="pool"></param>
 /// <param name="sCacheName"></param>
 internal void Init(SpawnPool pool, string sCacheName)
 {
     _pool       = pool;
     _sCacheName = sCacheName;
 }
 internal void Init(SpawnPool pool)
 {
     _pool       = pool;
     _sCacheName = null;
 }