void Awake() { if (!_instance) { _instance = this; } if (maxParticleCount <= 0) { Debug.LogError("maxParticleCount must be greater than zero"); } _pauseStatus = GameObject.FindObjectOfType <PauseHandler>(); _particleArray = new CircularArray <CustomParticle> (maxParticleCount); for (int i = 0; i < _particleArray.Capacity; i++) { var particle = Instantiate(particlePrefab); particle.transform.SetParent(transform); particle.SetActive(false); _particleArray [i] = particle.GetComponent <CustomParticle> (); } CustomParticle.UpdateEffectorList(); }
private void SwitchEmitters() { if (_currentEmitor != -1) { particleEmitters[_currentEmitor].SetActive(false); } _currentEmitor = (_currentEmitor + 1) % particleEmitters.Length; particleEmitters[_currentEmitor].SetActive(true); if (emitterText) { emitterText.text = preEmitterString + particleEmitters[_currentEmitor].name + postEmitterString; } if (updateEffectorsOnChange) { CustomParticle.UpdateEffectorList(); } }