예제 #1
0
        public EffectPositionIntegrator(WaterfallEffect effect, EffectPositionModifier posMod)
        {
            Utils.Log(String.Format("[EffectPositionIntegrator]: Initializing integrator for {0} on modifier {1}", effect.name, posMod.fxName), LogType.Modifiers);
            xforms        = new List <Transform>();
            transformName = posMod.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("[EffectPositionIntegrator]: Unable to find transform {0} on modifier {1}", transformName, posMod.fxName));
                }
                else
                {
                    xforms.Add(t1);
                }
            }



            handledModifiers = new List <EffectPositionModifier>();
            handledModifiers.Add(posMod);


            initialVectorValues = new List <Vector3>();
            for (int i = 0; i < xforms.Count; i++)
            {
                initialVectorValues.Add(xforms[i].localPosition);
            }
        }
예제 #2
0
 void RemovePositionModifier(EffectModifier fxMod)
 {
     try
     {
         EffectPositionModifier posMod = (EffectPositionModifier)fxMod;
         if (posMod != null)
         {
             foreach (EffectPositionIntegrator integrator in positionIntegrators)
             {
                 // If already exists as a handled modifier, don't touch me
                 if (integrator.handledModifiers.Contains(posMod))
                 {
                     integrator.RemoveModifier(posMod);
                     return;
                 }
             }
         }
     }
     catch (InvalidCastException e) { }
 }
예제 #3
0
        void ParsePositionModifier(EffectModifier fxMod)
        {
            try
            {
                EffectPositionModifier posMod = (EffectPositionModifier)fxMod;
                if (posMod != null)
                {
                    bool needsNewIntegrator = true;
                    EffectPositionIntegrator targetIntegrator = null;

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

                        // if there's already an integrator that has the transform name and float name, don't need to add
                        if (integrator.transformName == posMod.transformName)
                        {
                            targetIntegrator   = integrator;
                            needsNewIntegrator = false;
                        }
                    }
                    if (needsNewIntegrator)
                    {
                        EffectPositionIntegrator newIntegrator = new EffectPositionIntegrator(this, posMod);
                        positionIntegrators.Add(newIntegrator);
                    }
                    else if (!needsNewIntegrator)
                    {
                        if (targetIntegrator != null)
                        {
                            targetIntegrator.AddModifier(posMod);
                        }
                    }
                }
            }
            catch (InvalidCastException e) { }
        }
예제 #4
0
 public void RemoveModifier(EffectPositionModifier newMod)
 {
     handledModifiers.Remove(newMod);
 }
예제 #5
0
 public void AddModifier(EffectPositionModifier newMod)
 {
     handledModifiers.Add(newMod);
 }