예제 #1
0
    public Dictionary <ParticleGradType, ParticlesColor> GetParticleColors()
    {
        if (_particleSystems == null)
        {
            _particleSystems = GetComponent <ParticleSystem>();
        }

        Dictionary <ParticleGradType, ParticlesColor> particlesColors = new Dictionary <ParticleGradType, ParticlesColor>();

        ParticlesColor startColor = new ParticlesColor();
        ParticlesColor overLife   = new ParticlesColor();
        ParticlesColor bySpeed    = new ParticlesColor();

        startColor.gradType = ParticleGradType.StartColor;
        overLife.gradType   = ParticleGradType.OverLife;
        bySpeed.gradType    = ParticleGradType.BySpeed;

        startColor.particleSystemGrad = _particleSystems.main.startColor.gradient;
        overLife.particleSystemGrad   = _particleSystems.colorOverLifetime.color.gradient;
        bySpeed.particleSystemGrad    = _particleSystems.colorBySpeed.color.gradient;

        particlesColors.Add(ParticleGradType.StartColor, startColor);
        particlesColors.Add(ParticleGradType.OverLife, overLife);
        particlesColors.Add(ParticleGradType.BySpeed, bySpeed);

        return(particlesColors);
    }
예제 #2
0
    public void ChangeParticleColor(ParticlesColor.ColorEnum color)
    {
        Color newColor = ParticlesColor.GetColor(color);

        _trailRenderer.material.color = newColor;
        CurrentColor = color;
    }
예제 #3
0
    private void SaveSkinnable(SkinManagerSkinObjects skinObjects)
    {
        Dictionary <SkinnableType, SkinObject> lookup = skinObjects.GetLookup();

        if (_skinnable is SkinnableGeneral)
        {
            SkinnableGeneral skn = _skinnable as SkinnableGeneral;
            if (_skinnable is SkinnablePrefab)
            {
                (_skinnable as SkinnablePrefab).AssignRendererRef();
            }

            if (_saveMaterials)
            {
                SaveMaterials(lookup, skn);
            }
            if (_saveMatColors)
            {
                lookup[skn.type].materialColors = skn.GetColors(saveColors).ToArray();
            }
        }
        if (_skinnable is SkinnableMesh)
        {
            SkinnableMesh skn = _skinnable as SkinnableMesh;
            if (_saveMesh)
            {
                lookup[skn.type].mesh = skn.GetMesh();
            }
        }
        else if (_skinnable is SkinnablePrefab && !EditorApplication.isPlaying)
        {
            SkinnablePrefab skn = _skinnable as SkinnablePrefab;

            GameObject objectToReplace = (_skinnable as SkinnablePrefab).objectToReplace;
            if (objectToReplace != null)
            {
                lookup[skn.type].prefab = PrefabUtility.GetCorrespondingObjectFromSource(objectToReplace);
            }
        }
        else if (_skinnable is SkinnableParticles)
        {
            SkinnableParticles skn = _skinnable as SkinnableParticles;

            if (_saveParticleColors)
            {
                var colors = skn.GetParticleColors();
                ParticlesColor[] particlesColors = new ParticlesColor[colors.Count];

                int colorsCount = 0;
                if (_saveParticleStartColor)
                {
                    particlesColors[colorsCount] = colors[ParticleGradType.StartColor];
                    colorsCount++;
                }
                if (_saveParticleColorOverLife)
                {
                    particlesColors[colorsCount] = colors[ParticleGradType.OverLife];
                    colorsCount++;
                }
                if (_saveParticleColorBySpeed)
                {
                    particlesColors[colorsCount] = colors[ParticleGradType.BySpeed];
                }

                lookup[skn.type].particlesColors = particlesColors;
            }
        }

        if (_skinnable is SkinnableLight)
        {
            SkinnableLight skn = _skinnable as SkinnableLight;

            lookup[skn.type].lightObject = skn.GetLightObject();
        }
    }