public EffectFloatIntegrator(WaterfallEffect effect, EffectFloatModifier floatMod) { Utils.Log(String.Format("[EffectFloatIntegrator]: Initializing integrator for {0} on modifier {1}", effect.name, floatMod.fxName), LogType.Modifiers); xforms = new(); transformName = floatMod.transformName; parentEffect = effect; var roots = parentEffect.GetModelTransforms(); foreach (var t in roots) { var t1 = t.FindDeepChild(transformName); if (t1 == null) { Utils.LogError(String.Format("[EffectFloatIntegrator]: Unable to find transform {0} on modifier {1}", transformName, floatMod.fxName)); } else { xforms.Add(t1); } } // float specific floatName = floatMod.floatName; handledModifiers = new(); handledModifiers.Add(floatMod); foreach (string nm in WaterfallConstants.ShaderPropertyHideFloatNames) { if (floatName == nm) { testIntensity = true; } } initialFloatValues = new(); m = new Material[xforms.Count]; r = new Renderer[xforms.Count]; for (int i = 0; i < xforms.Count; i++) { r[i] = xforms[i].GetComponent <Renderer>(); m[i] = r[i].material; initialFloatValues.Add(m[i].GetFloat(floatName)); } }
void RemoveFloatModifier(EffectModifier fxMod) { try { EffectFloatModifier floatMod = (EffectFloatModifier)fxMod; if (floatMod != null) { foreach (EffectFloatIntegrator floatInt in floatIntegrators) { // If already exists as a handled modifier, don't touch me if (floatInt.handledModifiers.Contains(floatMod)) { floatInt.RemoveModifier(floatMod); return; } } } } catch (InvalidCastException e) { } }
void ParseFloatModifier(EffectModifier fxMod) { try { EffectFloatModifier floatMod = (EffectFloatModifier)fxMod; if (floatMod != null) { bool needsNewIntegrator = true; EffectFloatIntegrator targetIntegrator = null; foreach (EffectFloatIntegrator floatInt in floatIntegrators) { // If already exists as a handled modifier, don't touch me if (floatInt.handledModifiers.Contains(floatMod)) { return; } // if there's already an integrator that has the transform name and float name, don't need to add if (floatInt.floatName == floatMod.floatName && floatInt.transformName == floatMod.transformName) { targetIntegrator = floatInt; needsNewIntegrator = false; } } if (needsNewIntegrator && floatMod.floatName != "") { EffectFloatIntegrator newIntegrator = new EffectFloatIntegrator(this, floatMod); floatIntegrators.Add(newIntegrator); } else if (!needsNewIntegrator && floatMod.floatName != "") { if (targetIntegrator != null) { targetIntegrator.AddModifier(floatMod); } } } } catch (InvalidCastException e) { } }
public void RemoveModifier(EffectFloatModifier newMod) { handledModifiers.Remove(newMod); }
public void AddModifier(EffectFloatModifier newMod) { handledModifiers.Add(newMod); }