Пример #1
0
        public EffectRotationIntegrator(WaterfallEffect effect, EffectRotationModifier mod)
        {
            Utils.Log(String.Format("[EffectRotationIntegrator]: Initializing integrator for {0} on modifier {1}", effect.name, mod.fxName), LogType.Modifiers);
            xforms        = new List <Transform>();
            transformName = mod.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("[EffectRotationIntegrator]: Unable to find transform {0} on modifier {1}", transformName, mod.fxName));
                }
                else
                {
                    xforms.Add(t1);
                }
            }



            handledModifiers = new List <EffectRotationModifier>();
            handledModifiers.Add(mod);


            initialVectorValues = new List <Vector3>();
            for (int i = 0; i < xforms.Count; i++)
            {
                initialVectorValues.Add(xforms[i].localEulerAngles);
            }
        }
Пример #2
0
 void RemoveRotationModifier(EffectModifier fxMod)
 {
     try
     {
         EffectRotationModifier mod = (EffectRotationModifier)fxMod;
         if (mod != null)
         {
             foreach (EffectRotationIntegrator integrator in rotationIntegrators)
             {
                 // If already exists as a handled modifier, don't touch me
                 if (integrator.handledModifiers.Contains(mod))
                 {
                     integrator.RemoveModifier(mod);
                     return;
                 }
             }
         }
     }
     catch (InvalidCastException e) { }
 }
Пример #3
0
        void ParseRotationModifier(EffectModifier fxMod)
        {
            try
            {
                EffectRotationModifier rotMod = (EffectRotationModifier)fxMod;
                if (rotMod != null)
                {
                    bool needsNewIntegrator = true;
                    EffectRotationIntegrator targetIntegrator = null;

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

                        // if there's already an integrator that has the transform name and float name, don't need to add
                        if (integrator.transformName == rotMod.transformName)
                        {
                            targetIntegrator   = integrator;
                            needsNewIntegrator = false;
                        }
                    }
                    if (needsNewIntegrator)
                    {
                        EffectRotationIntegrator newIntegrator = new EffectRotationIntegrator(this, rotMod);
                        rotationIntegrators.Add(newIntegrator);
                    }
                    else if (!needsNewIntegrator)
                    {
                        if (targetIntegrator != null)
                        {
                            targetIntegrator.AddModifier(rotMod);
                        }
                    }
                }
            }
            catch (InvalidCastException e) { }
        }
Пример #4
0
 public void RemoveModifier(EffectRotationModifier newMod)
 {
     handledModifiers.Remove(newMod);
 }
Пример #5
0
 public void AddModifier(EffectRotationModifier newMod)
 {
     handledModifiers.Add(newMod);
 }