private static void DestroyIfPossible(GameObject gameObject) { ParticlePal particlePal = gameObject.GetComponent <ParticlePal>(); if (particlePal == null) { return; } if (WillDelete(gameObject)) { Destroy(gameObject); } else { //couldn't delete all the children; can't delete me //Need to fix this performanceinfo data up mmcmanus //if (!particlePal.isEnabled[(int)PerformanceManager.ParticleQuality]) if (!particlePal.isEnabled[(int)PerformanceInfo.ePARTICLE_QUALITY.High]) { //disable the particle system, then disable particlePal gameObject.GetComponent <ParticleSystem>().Pause(); var ps = gameObject.GetComponent <ParticleSystem>(); var em = ps.emission; em.enabled = false; particlePal.enabled = false; } } }
public static bool DisabledByParticlePal(GameObject gameObject) { ParticlePal particlePal = gameObject.GetComponent <ParticlePal>(); if (particlePal == null) { return(false); } if (particlePal.isEnabled == null || particlePal.isEnabled.Count != PerformanceInfo.ePARTICLE_QUALITY_COUNT) { particlePal.isEnabled = new List <bool>() { true, true, true }; } //Need to fix this performanceinfo data up mmcmanus if (PerformanceManager.Instance.CurrentEnvironmentInfo == null) //by pj 编辑场景没有会为空 { return(false); } return(!particlePal.isEnabled[(int)PerformanceManager.Instance.CurrentEnvironmentInfo.particleQuality]); //return !particlePal.isEnabled[(int)PerformanceInfo.ePARTICLE_QUALITY.High]; }
private void RegisterFxParticles(int seq, object arg) { GameObject go = arg as GameObject; if (go != null && !ParticlePal.WillDelete(go)) { PSPoolManager.Instance.Register(go, 1, PSPoolManager.Persistence.Temp); } }
public static void EnableEmission(this ParticleSystem ps, bool enable) { if (ps == null) { return; } ParticleSystem[] particleSystems = ps.GetComponentsInChildren <ParticleSystem>(true); for (int i = 0; i < particleSystems.Length; i++) { //particleSystems[i].enableEmission = enable ? !ParticlePal.DisabledByParticlePal(particleSystems[i].gameObject) : false; var em = particleSystems[i].emission; bool isvisible = enable && !ParticlePal.DisabledByParticlePal(particleSystems[i].gameObject); if (em.enabled != isvisible) { em.enabled = isvisible; } } }