public SpawnPool CreateSpawnPool(string id, Transform prefab, int maxCount = -1, int preloadAmount = 1) { SpawnPool spawnPool = new SpawnPool(id, prefab, maxCount, preloadAmount, this); this._spawnPools.Add(id, spawnPool); return(spawnPool); }
public void OnSpawn(SpawnPool spawnPool) { for (int i = 0; i < onSpawnInterfaces.Count; i++) { onSpawnInterfaces[i].OnPoolSpawn(spawnPool); } }
public void OnPoolSpawn(SpawnPool spawnPool) { this.spawnPool = spawnPool; if (targetParticle != null) { timer = StartCoroutine(ListenForEmitDespawn()); } }
internal PoolGameObject(SpawnPool spawnPool, Transform transform) { this.spawnPool = spawnPool; this.id = this.spawnPool.id; this.transform = transform; if (this.transform != null) { this.ogiPosition = this.transform.localPosition; this.ogiDirection = this.transform.localRotation; this.ogiScale = this.transform.localScale; } }
public void ClearDespawned() { List <string> tobeRemoved = new List <string>(); foreach (KeyValuePair <string, SpawnPool> kv in this._spawnPools) { SpawnPool spawnPool = kv.Value; spawnPool.DisposeDespawned(); //如果已经没有已经孵化的对象则移走该spawnPool if (spawnPool.prefab == null) { tobeRemoved.Add(kv.Key); } } int count = tobeRemoved.Count; for (int i = 0; i < count; i++) { string key = tobeRemoved[i]; this._spawnPools.Remove(key); } }
public void OnPoolSpawn(SpawnPool spawnPool) { this.spawnPool = spawnPool; timer = StartCoroutine(DespawnTimer()); }