void RemoveLightColorModifier(EffectModifier fxMod) { try { EffectLightColorModifier mod = (EffectLightColorModifier)fxMod; if (mod != null) { foreach (EffectLightColorIntegrator integrator in lightColorIntegrators) { // If already exists as a handled modifier, don't touch me if (integrator.handledModifiers.Contains(mod)) { integrator.RemoveModifier(mod); return; } } } } catch (InvalidCastException e) { } }
void ParseLightColorModifier(EffectModifier fxMod) { try { EffectLightColorModifier colorMod = (EffectLightColorModifier)fxMod; if (colorMod != null) { bool needsNewIntegrator = true; EffectLightColorIntegrator targetIntegrator = null; foreach (EffectLightColorIntegrator integrator in lightColorIntegrators) { // 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 != "") { EffectLightColorIntegrator newIntegrator = new EffectLightColorIntegrator(this, colorMod); lightColorIntegrators.Add(newIntegrator); } else if (!needsNewIntegrator && colorMod.colorName != "") { if (targetIntegrator != null) { targetIntegrator.AddModifier(colorMod); } } } } catch (InvalidCastException e) { } }
public EffectLightColorIntegrator(WaterfallEffect effect, EffectLightColorModifier floatMod) { Utils.Log(String.Format("[EffectLightColorIntegrator]: Initializing integrator for {0} on modifier {1}", effect.name, floatMod.fxName), LogType.Modifiers); xforms = new List <Transform>(); transformName = floatMod.transformName; parentEffect = effect; List <Transform> roots = parentEffect.GetModelTransforms(); foreach (Transform t in roots) { Transform t1 = t.FindDeepChild(transformName); if (t1 == null) { Utils.LogError(String.Format("[EffectLightColorIntegrator]: Unable to find transform {0} on modifier {1}", transformName, floatMod.fxName)); } else { xforms.Add(t1); } } // float specific colorName = floatMod.colorName; handledModifiers = new List <EffectLightColorModifier>(); handledModifiers.Add(floatMod); initialColorValues = new List <Color>(); l = new Light[xforms.Count]; for (int i = 0; i < xforms.Count; i++) { l[i] = xforms[i].GetComponent <Light>(); initialColorValues.Add(l[i].color); } }
public void RemoveModifier(EffectLightColorModifier newMod) { handledModifiers.Remove(newMod); }
public void AddModifier(EffectLightColorModifier newMod) { handledModifiers.Add(newMod); }