Esempio n. 1
0
 void RemoveColorModifier(EffectModifier fxMod)
 {
     try
     {
         EffectColorModifier mod = (EffectColorModifier)fxMod;
         if (mod != null)
         {
             foreach (EffectColorIntegrator integrator in colorIntegrators)
             {
                 // If already exists as a handled modifier, don't touch me
                 if (integrator.handledModifiers.Contains(mod))
                 {
                     integrator.RemoveModifier(mod);
                     return;
                 }
             }
         }
     }
     catch (InvalidCastException e) { }
 }
Esempio n. 2
0
        void ParseColorModifier(EffectModifier fxMod)
        {
            try
            {
                EffectColorModifier colorMod = (EffectColorModifier)fxMod;
                if (colorMod != null)
                {
                    bool needsNewIntegrator = true;
                    EffectColorIntegrator targetIntegrator = null;

                    foreach (EffectColorIntegrator integrator in colorIntegrators)
                    {
                        // If already exists as a handled modifier, don't touch me
                        if (integrator.handledModifiers.Contains(colorMod))
                        {
                            return;
                        }

                        // if there's already an integrator that has the transform name and float name, don't need to add
                        if (integrator.colorName == colorMod.colorName && integrator.transformName == colorMod.transformName)
                        {
                            targetIntegrator   = integrator;
                            needsNewIntegrator = false;
                        }
                    }
                    if (needsNewIntegrator && colorMod.colorName != "")
                    {
                        EffectColorIntegrator newIntegrator = new EffectColorIntegrator(this, colorMod);
                        colorIntegrators.Add(newIntegrator);
                    }
                    else if (!needsNewIntegrator && colorMod.colorName != "")
                    {
                        if (targetIntegrator != null)
                        {
                            targetIntegrator.AddModifier(colorMod);
                        }
                    }
                }
            }
            catch (InvalidCastException e) { }
        }
Esempio n. 3
0
        public EffectColorIntegrator(WaterfallEffect effect, EffectColorModifier colorMod)
        {
            Utils.Log(String.Format("[EffectColorIntegrator]: Initializing integrator for {0} on modifier {1}", effect.name, colorMod.fxName), LogType.Modifiers);
            xforms        = new();
            transformName = colorMod.transformName;
            parentEffect  = effect;
            var roots = parentEffect.GetModelTransforms();

            foreach (var t in roots)
            {
                var t1 = t.FindDeepChild(transformName);
                if (t1 == null)
                {
                    Utils.LogError(String.Format("[EffectColorIntegrator]: Unable to find transform {0} on modifier {1}", transformName, colorMod.fxName));
                }
                else
                {
                    xforms.Add(t1);
                }
            }


            // float specific
            colorName        = colorMod.colorName;
            handledModifiers = new();
            handledModifiers.Add(colorMod);


            initialColorValues = new();
            m = new Material[xforms.Count];
            for (int i = 0; i < xforms.Count; i++)
            {
                m[i] = xforms[i].GetComponent <Renderer>().material;
                initialColorValues.Add(m[i].GetColor(colorName));
            }
        }
Esempio n. 4
0
 public void RemoveModifier(EffectColorModifier newMod)
 {
     handledModifiers.Remove(newMod);
 }
Esempio n. 5
0
 public void AddModifier(EffectColorModifier newMod)
 {
     handledModifiers.Add(newMod);
 }