Esempio n. 1
0
    // delete particle when quality in particle level on it NOT meets global control quality
    private static bool DestroyIfPossible(GameObject gameObject)
    {
        XParticleLevel particleLevel = gameObject.GetComponent <XParticleLevel>();

        if (particleLevel == null)
        {
            return(false);
        }
        bool isDestroyOrDisable = false;

        if (CanDelete(gameObject))
        {
            Destroy(gameObject);
            isDestroyOrDisable = true;
        }
        else
        {
            var quality = particleLevel.GetQuality();
            if ((quality == eQUALITY.Off) || !particleLevel.IsQualitysEnabled[(int)quality])
            {
                ParticleSystem particle = gameObject.GetComponent <ParticleSystem>();
                if (particle != null)
                {
                    particle.Pause();
                    ParticleSystem.EmissionModule emi = particle.emission;
                    emi.enabled           = false;
                    particleLevel.enabled = false;
                }
                isDestroyOrDisable = true;
            }
        }
        return(isDestroyOrDisable);
    }
Esempio n. 2
0
    public static bool DisabledByParticleLevel(GameObject gameObject)
    {
        XParticleLevel particleLevel = gameObject.GetComponent <XParticleLevel>();

        if (particleLevel == null)
        {
            return(false);
        }

        if (particleLevel.IsQualitysEnabled == null || particleLevel.IsQualitysEnabled.Count != XParticleLevel.QUALITY_COUNT)
        {
            particleLevel.IsQualitysEnabled = new List <bool>()
            {
                true, true, true
            };
        }

        var quality = particleLevel.GetQuality();

        return((quality == eQUALITY.Off) || !particleLevel.IsQualitysEnabled[(int)quality]);
    }