예제 #1
0
        public ParticleTrickData(ParticleSystem ps)
        {
            bDynamicParticle_SelfColliderOn = true;
            bUseTrick      = true;
            bOverrideColor = true;
            sortingLayer   = 0;
            layerMask      = 1 << LayerMask.NameToLayer("Default");
            startColorData = CopyColor(ps.main.startColor);

            var main = ps.main;

            hiddenColor     = Color.clear;
            main.startColor = hiddenColor;

            if (ps == null)
            {
                _ps  = null;
                _prr = null;
                fParticleSortingFudge = 0f;
                return;
            }

            _ps  = ps;
            _prr = _ps.GetComponent <ParticleSystemRenderer>();
            fParticleSortingFudge = _prr.sortingFudge;
        }
예제 #2
0
        static MinMaxGradientData CopyColor(ParticleSystem.MinMaxGradient _startColor)
        {
            MinMaxGradientData _sc;

            if (_startColor.mode == ParticleSystemGradientMode.Gradient ||
                _startColor.mode == ParticleSystemGradientMode.RandomColor)
            {
                _sc = new MinMaxGradientData(_startColor.gradient, _startColor.mode);
            }
            else if (_startColor.mode == ParticleSystemGradientMode.TwoColors)
            {
                _sc = new MinMaxGradientData(_startColor.colorMin, _startColor.colorMax);
            }
            else if (_startColor.mode == ParticleSystemGradientMode.TwoGradients)
            {
                _sc = new MinMaxGradientData(_startColor.gradientMin, _startColor.gradientMax);
            }
            else // if (ps.main.startColor.mode == ParticleSystemGradientMode.Color)
            {
                _sc = new MinMaxGradientData(_startColor.color);
            }
            return(_sc);
        }