2using System.Collections;
3using System.Collections.Generic;
57 GameObject gameObject = UnityEngine.Object.Instantiate(pool.
prefab);
58 AudioSource component = gameObject.GetComponent<AudioSource>();
59 if (pool.
tag ==
"AudioExplosion")
65 else if (pool.
tag ==
"AudioShot")
71 gameObject.transform.parent = base.gameObject.transform;
72 gameObject.SetActive(value:
false);
73 queue.Enqueue(gameObject);
82 Debug.LogWarning(
"Pool with tag" + tag +
" does not excist.");
86 gameObject.SetActive(value:
true);
88 gameObject.transform.position = position;
95 ParticleSystem.Particle[] array =
new ParticleSystem.Particle[GetComponent<ParticleSystem>().particleCount];
96 int particles = GetComponent<ParticleSystem>().GetParticles(array);
97 for (
int i = 0; i < particles; i++)
99 if (
audioExplosion.Length != 0 && array[i].remainingLifetime < Time.deltaTime)
102 if (gameObject !=
null)
104 StartCoroutine(
LateCall(gameObject));
107 if (
audioShot.Length != 0 && array[i].remainingLifetime >= array[i].startLifetime - Time.deltaTime)
110 if (gameObject2 !=
null)
112 StartCoroutine(
LateCall(gameObject2));
118 private IEnumerator
LateCall(GameObject soundInstance)
121 soundInstance.SetActive(value:
false);
IEnumerator LateCall(GameObject soundInstance)
AudioClip[] audioExplosion
static HS_ParticleEndSound SharedInstance
Dictionary< string, Queue< GameObject > > poolDictionary
GameObject SpawnFromPool(string tag, Vector3 position)