Ejemplo n.º 1
0
        public static VolumeEffect BlendValuesToVolumeEffect(VolumeEffectFlags flags, VolumeEffect volume1, VolumeEffect volume2, float blend)
        {
            VolumeEffect volumeEffect = new VolumeEffect(volume1.gameObject);

            foreach (VolumeEffectComponentFlags compFlags in flags.components)
            {
                if (compFlags.blendFlag)
                {
                    VolumeEffectComponent volumeEffectComponent  = volume1.components.Find((VolumeEffectComponent s) => s.componentName == compFlags.componentName);
                    VolumeEffectComponent volumeEffectComponent2 = volume2.components.Find((VolumeEffectComponent s) => s.componentName == compFlags.componentName);
                    if (volumeEffectComponent != null && volumeEffectComponent2 != null)
                    {
                        VolumeEffectComponent volumeEffectComponent3 = new VolumeEffectComponent(volumeEffectComponent.componentName);
                        foreach (VolumeEffectFieldFlags fieldFlags in compFlags.componentFields)
                        {
                            if (fieldFlags.blendFlag)
                            {
                                VolumeEffectField volumeEffectField  = volumeEffectComponent.fields.Find((VolumeEffectField s) => s.fieldName == fieldFlags.fieldName);
                                VolumeEffectField volumeEffectField2 = volumeEffectComponent2.fields.Find((VolumeEffectField s) => s.fieldName == fieldFlags.fieldName);
                                if (volumeEffectField != null && volumeEffectField2 != null)
                                {
                                    VolumeEffectField volumeEffectField3 = new VolumeEffectField(volumeEffectField.fieldName, volumeEffectField.fieldType);
                                    string            fieldType          = volumeEffectField3.fieldType;
                                    switch (fieldType)
                                    {
                                    case "System.Single":
                                        volumeEffectField3.valueSingle = Mathf.Lerp(volumeEffectField.valueSingle, volumeEffectField2.valueSingle, blend);
                                        break;

                                    case "System.Boolean":
                                        volumeEffectField3.valueBoolean = volumeEffectField2.valueBoolean;
                                        break;

                                    case "UnityEngine.Vector2":
                                        volumeEffectField3.valueVector2 = Vector2.Lerp(volumeEffectField.valueVector2, volumeEffectField2.valueVector2, blend);
                                        break;

                                    case "UnityEngine.Vector3":
                                        volumeEffectField3.valueVector3 = Vector3.Lerp(volumeEffectField.valueVector3, volumeEffectField2.valueVector3, blend);
                                        break;

                                    case "UnityEngine.Vector4":
                                        volumeEffectField3.valueVector4 = Vector4.Lerp(volumeEffectField.valueVector4, volumeEffectField2.valueVector4, blend);
                                        break;

                                    case "UnityEngine.Color":
                                        volumeEffectField3.valueColor = Color.Lerp(volumeEffectField.valueColor, volumeEffectField2.valueColor, blend);
                                        break;
                                    }
                                    volumeEffectComponent3.fields.Add(volumeEffectField3);
                                }
                            }
                        }
                        volumeEffect.components.Add(volumeEffectComponent3);
                    }
                }
            }
            return(volumeEffect);
        }
Ejemplo n.º 2
0
        public void BlendValues(AmplifyColorEffect targetColor, VolumeEffect other, float blendAmount)
        {
            VolumeEffectFlags effectFlags = targetColor.EffectFlags;
            GameObject        go          = targetColor.gameObject;

            for (int comp = 0; comp < effectFlags.components.Count; comp++)
            {
                VolumeEffectComponentFlags compFlags = effectFlags.components[comp];
                if (!compFlags.blendFlag)
                {
                    continue;
                }

                Component             c               = go.GetComponent(compFlags.componentName);
                VolumeEffectComponent effectComp      = FindEffectComponent(compFlags.componentName);
                VolumeEffectComponent effectCompOther = other.FindEffectComponent(compFlags.componentName);
                if (c == null || effectComp == null || effectCompOther == null)
                {
                    continue;
                }

                for (int i = 0; i < compFlags.componentFields.Count; i++)
                {
                    VolumeEffectFieldFlags fieldFlags = compFlags.componentFields[i];
                    if (!fieldFlags.blendFlag)
                    {
                        continue;
                    }

#if !UNITY_EDITOR && UNITY_METRO
                    FieldInfo fi = c.GetType().GetRuntimeField(fieldFlags.fieldName);
#else
                    FieldInfo fi = c.GetType().GetField(fieldFlags.fieldName);
#endif
                    VolumeEffectField effectField      = effectComp.FindEffectField(fieldFlags.fieldName);
                    VolumeEffectField effectFieldOther = effectCompOther.FindEffectField(fieldFlags.fieldName);

                    if (fi == null || effectField == null || effectFieldOther == null)
                    {
                        continue;
                    }

                    switch (fi.FieldType.FullName)
                    {
                    case "System.Single": fi.SetValue(c, Mathf.Lerp(effectField.valueSingle, effectFieldOther.valueSingle, blendAmount)); break;

                    case "System.Boolean": fi.SetValue(c, effectFieldOther.valueBoolean); break;

                    case "UnityEngine.Vector2": fi.SetValue(c, Vector2.Lerp(effectField.valueVector2, effectFieldOther.valueVector2, blendAmount)); break;

                    case "UnityEngine.Vector3": fi.SetValue(c, Vector3.Lerp(effectField.valueVector3, effectFieldOther.valueVector3, blendAmount)); break;

                    case "UnityEngine.Vector4": fi.SetValue(c, Vector4.Lerp(effectField.valueVector4, effectFieldOther.valueVector4, blendAmount)); break;

                    case "UnityEngine.Color": fi.SetValue(c, Color.Lerp(effectField.valueColor, effectFieldOther.valueColor, blendAmount)); break;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void BlendValues(AmplifyColorBase targetColor, VolumeEffect other, float blendAmount)
        {
            VolumeEffectFlags effectFlags = targetColor.EffectFlags;
            GameObject        gameObject  = targetColor.gameObject;

            foreach (VolumeEffectComponentFlags compFlags in effectFlags.components)
            {
                if (compFlags.blendFlag)
                {
                    Component             component              = gameObject.GetComponent(compFlags.componentName);
                    VolumeEffectComponent volumeEffectComponent  = this.components.Find((VolumeEffectComponent s) => s.componentName == compFlags.componentName);
                    VolumeEffectComponent volumeEffectComponent2 = other.components.Find((VolumeEffectComponent s) => s.componentName == compFlags.componentName);
                    if (!(component == null) && volumeEffectComponent != null && volumeEffectComponent2 != null)
                    {
                        foreach (VolumeEffectFieldFlags fieldFlags in compFlags.componentFields)
                        {
                            if (fieldFlags.blendFlag)
                            {
                                FieldInfo         field              = component.GetType().GetField(fieldFlags.fieldName);
                                VolumeEffectField volumeEffectField  = volumeEffectComponent.fields.Find((VolumeEffectField s) => s.fieldName == fieldFlags.fieldName);
                                VolumeEffectField volumeEffectField2 = volumeEffectComponent2.fields.Find((VolumeEffectField s) => s.fieldName == fieldFlags.fieldName);
                                if (field != null && volumeEffectField != null && volumeEffectField2 != null)
                                {
                                    string fullName = field.FieldType.FullName;
                                    switch (fullName)
                                    {
                                    case "System.Single":
                                        field.SetValue(component, Mathf.Lerp(volumeEffectField.valueSingle, volumeEffectField2.valueSingle, blendAmount));
                                        break;

                                    case "System.Boolean":
                                        field.SetValue(component, volumeEffectField2.valueBoolean);
                                        break;

                                    case "UnityEngine.Vector2":
                                        field.SetValue(component, Vector2.Lerp(volumeEffectField.valueVector2, volumeEffectField2.valueVector2, blendAmount));
                                        break;

                                    case "UnityEngine.Vector3":
                                        field.SetValue(component, Vector3.Lerp(volumeEffectField.valueVector3, volumeEffectField2.valueVector3, blendAmount));
                                        break;

                                    case "UnityEngine.Vector4":
                                        field.SetValue(component, Vector4.Lerp(volumeEffectField.valueVector4, volumeEffectField2.valueVector4, blendAmount));
                                        break;

                                    case "UnityEngine.Color":
                                        field.SetValue(component, Color.Lerp(volumeEffectField.valueColor, volumeEffectField2.valueColor, blendAmount));
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void SetValues(AmplifyColorBase targetColor)
        {
            VolumeEffectFlags effectFlags = targetColor.EffectFlags;
            GameObject        gameObject  = targetColor.gameObject;

            foreach (VolumeEffectComponentFlags compFlags in effectFlags.components)
            {
                if (compFlags.blendFlag)
                {
                    Component             component             = gameObject.GetComponent(compFlags.componentName);
                    VolumeEffectComponent volumeEffectComponent = this.components.Find((VolumeEffectComponent s) => s.componentName == compFlags.componentName);
                    if (!(component == null) && volumeEffectComponent != null)
                    {
                        foreach (VolumeEffectFieldFlags fieldFlags in compFlags.componentFields)
                        {
                            if (fieldFlags.blendFlag)
                            {
                                FieldInfo         field             = component.GetType().GetField(fieldFlags.fieldName);
                                VolumeEffectField volumeEffectField = volumeEffectComponent.fields.Find((VolumeEffectField s) => s.fieldName == fieldFlags.fieldName);
                                if (field != null && volumeEffectField != null)
                                {
                                    string fullName = field.FieldType.FullName;
                                    switch (fullName)
                                    {
                                    case "System.Single":
                                        field.SetValue(component, volumeEffectField.valueSingle);
                                        break;

                                    case "System.Boolean":
                                        field.SetValue(component, volumeEffectField.valueBoolean);
                                        break;

                                    case "UnityEngine.Vector2":
                                        field.SetValue(component, volumeEffectField.valueVector2);
                                        break;

                                    case "UnityEngine.Vector3":
                                        field.SetValue(component, volumeEffectField.valueVector3);
                                        break;

                                    case "UnityEngine.Vector4":
                                        field.SetValue(component, volumeEffectField.valueVector4);
                                        break;

                                    case "UnityEngine.Color":
                                        field.SetValue(component, volumeEffectField.valueColor);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void SetValues(AmplifyColorEffect targetColor)
        {
            VolumeEffectFlags effectFlags = targetColor.EffectFlags;
            GameObject        go          = targetColor.gameObject;

            foreach (VolumeEffectComponentFlags compFlags in effectFlags.components)
            {
                if (!compFlags.blendFlag)
                {
                    continue;
                }

                Component             c          = go.GetComponent(compFlags.componentName);
                VolumeEffectComponent effectComp = FindEffectComponent(compFlags.componentName);
                if (c == null || effectComp == null)
                {
                    continue;
                }

                foreach (VolumeEffectFieldFlags fieldFlags in compFlags.componentFields)
                {
                    if (!fieldFlags.blendFlag)
                    {
                        continue;
                    }

#if !UNITY_EDITOR && UNITY_METRO
                    FieldInfo fi = c.GetType().GetRuntimeField(fieldFlags.fieldName);
#else
                    FieldInfo fi = c.GetType().GetField(fieldFlags.fieldName);
#endif
                    VolumeEffectField effectField = effectComp.FindEffectField(fieldFlags.fieldName);
                    if (fi == null || effectField == null)
                    {
                        continue;
                    }

                    switch (fi.FieldType.FullName)
                    {
                    case "System.Single": fi.SetValue(c, effectField.valueSingle); break;

                    case "System.Boolean": fi.SetValue(c, effectField.valueBoolean); break;

                    case "UnityEngine.Vector2": fi.SetValue(c, effectField.valueVector2); break;

                    case "UnityEngine.Vector3": fi.SetValue(c, effectField.valueVector3); break;

                    case "UnityEngine.Vector4": fi.SetValue(c, effectField.valueVector4); break;

                    case "UnityEngine.Color": fi.SetValue(c, effectField.valueColor); break;
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public static VolumeEffect BlendValuesToVolumeEffect(VolumeEffectFlags flags, VolumeEffect volume1, VolumeEffect volume2, float blend)
        {
            VolumeEffect resultVolume = new VolumeEffect(volume1.gameObject);

            foreach (VolumeEffectComponentFlags compFlags in flags.components)
            {
                if (!compFlags.blendFlag)
                {
                    continue;
                }

                VolumeEffectComponent ec1 = volume1.FindEffectComponent(compFlags.componentName);
                VolumeEffectComponent ec2 = volume2.FindEffectComponent(compFlags.componentName);
                if (ec1 == null || ec2 == null)
                {
                    continue;
                }

                VolumeEffectComponent resultComp = new VolumeEffectComponent(ec1.componentName);
                foreach (VolumeEffectFieldFlags fieldFlags in compFlags.componentFields)
                {
                    if (fieldFlags.blendFlag)
                    {
                        VolumeEffectField ef1 = ec1.FindEffectField(fieldFlags.fieldName);
                        VolumeEffectField ef2 = ec2.FindEffectField(fieldFlags.fieldName);
                        if (ef1 == null || ef2 == null)
                        {
                            continue;
                        }

                        VolumeEffectField resultField = new VolumeEffectField(ef1.fieldName, ef1.fieldType);

                        switch (resultField.fieldType)
                        {
                        case "System.Single": resultField.valueSingle = Mathf.Lerp(ef1.valueSingle, ef2.valueSingle, blend); break;

                        case "System.Boolean": resultField.valueBoolean = ef2.valueBoolean; break;

                        case "UnityEngine.Vector2": resultField.valueVector2 = Vector2.Lerp(ef1.valueVector2, ef2.valueVector2, blend); break;

                        case "UnityEngine.Vector3": resultField.valueVector3 = Vector3.Lerp(ef1.valueVector3, ef2.valueVector3, blend); break;

                        case "UnityEngine.Vector4": resultField.valueVector4 = Vector4.Lerp(ef1.valueVector4, ef2.valueVector4, blend); break;

                        case "UnityEngine.Color": resultField.valueColor = Color.Lerp(ef1.valueColor, ef2.valueColor, blend); break;
                        }

                        resultComp.fields.Add(resultField);
                    }
                }
                resultVolume.components.Add(resultComp);
            }
            return(resultVolume);
        }
Ejemplo n.º 7
0
 public static VolumeEffect BlendValuesToVolumeEffect(VolumeEffectFlags flags, VolumeEffect volume1, VolumeEffect volume2, float blend)
 {
     VolumeEffect volumeEffect = new VolumeEffect(volume1.gameObject);
     foreach (VolumeEffectComponentFlags compFlags in flags.components)
     {
         if (compFlags.blendFlag)
         {
             VolumeEffectComponent volumeEffectComponent = volume1.components.Find((VolumeEffectComponent s) => s.componentName == compFlags.componentName);
             VolumeEffectComponent volumeEffectComponent2 = volume2.components.Find((VolumeEffectComponent s) => s.componentName == compFlags.componentName);
             if (volumeEffectComponent != null && volumeEffectComponent2 != null)
             {
                 VolumeEffectComponent volumeEffectComponent3 = new VolumeEffectComponent(volumeEffectComponent.componentName);
                 foreach (VolumeEffectFieldFlags fieldFlags in compFlags.componentFields)
                 {
                     if (fieldFlags.blendFlag)
                     {
                         VolumeEffectField volumeEffectField = volumeEffectComponent.fields.Find((VolumeEffectField s) => s.fieldName == fieldFlags.fieldName);
                         VolumeEffectField volumeEffectField2 = volumeEffectComponent2.fields.Find((VolumeEffectField s) => s.fieldName == fieldFlags.fieldName);
                         if (volumeEffectField != null && volumeEffectField2 != null)
                         {
                             VolumeEffectField volumeEffectField3 = new VolumeEffectField(volumeEffectField.fieldName, volumeEffectField.fieldType);
                             string fieldType = volumeEffectField3.fieldType;
                             switch (fieldType)
                             {
                             case "System.Single":
                                 volumeEffectField3.valueSingle = Mathf.Lerp(volumeEffectField.valueSingle, volumeEffectField2.valueSingle, blend);
                                 break;
                             case "System.Boolean":
                                 volumeEffectField3.valueBoolean = volumeEffectField2.valueBoolean;
                                 break;
                             case "UnityEngine.Vector2":
                                 volumeEffectField3.valueVector2 = Vector2.Lerp(volumeEffectField.valueVector2, volumeEffectField2.valueVector2, blend);
                                 break;
                             case "UnityEngine.Vector3":
                                 volumeEffectField3.valueVector3 = Vector3.Lerp(volumeEffectField.valueVector3, volumeEffectField2.valueVector3, blend);
                                 break;
                             case "UnityEngine.Vector4":
                                 volumeEffectField3.valueVector4 = Vector4.Lerp(volumeEffectField.valueVector4, volumeEffectField2.valueVector4, blend);
                                 break;
                             case "UnityEngine.Color":
                                 volumeEffectField3.valueColor = Color.Lerp(volumeEffectField.valueColor, volumeEffectField2.valueColor, blend);
                                 break;
                             }
                             volumeEffectComponent3.fields.Add(volumeEffectField3);
                         }
                     }
                 }
                 volumeEffect.components.Add(volumeEffectComponent3);
             }
         }
     }
     return volumeEffect;
 }
Ejemplo n.º 8
0
        public static VolumeEffect BlendValuesToVolumeEffect( VolumeEffectFlags flags, VolumeEffect volume1, VolumeEffect volume2, float blend )
        {
            VolumeEffect resultVolume = new VolumeEffect( volume1.gameObject );
            foreach ( VolumeEffectComponentFlags compFlags in flags.components )
            {
            if ( !compFlags.blendFlag )
                continue;

            VolumeEffectComponent ec1 = volume1.components.Find( s => s.componentName == compFlags.componentName );
            VolumeEffectComponent ec2 = volume2.components.Find( s => s.componentName == compFlags.componentName );
            if ( ec1 == null || ec2 == null )
                continue;

            VolumeEffectComponent resultComp = new VolumeEffectComponent( ec1.componentName );
            foreach ( VolumeEffectFieldFlags fieldFlags in compFlags.componentFields )
            {
                if ( fieldFlags.blendFlag )
                {
                    VolumeEffectField ef1 = ec1.fields.Find( s => s.fieldName == fieldFlags.fieldName );
                    VolumeEffectField ef2 = ec2.fields.Find( s => s.fieldName == fieldFlags.fieldName );
                    if ( ef1 == null || ef2 == null )
                        continue;

                    VolumeEffectField resultField = new VolumeEffectField( ef1.fieldName, ef1.fieldType );

                    switch ( resultField.fieldType )
                    {
                        case "System.Single": resultField.valueSingle = Mathf.Lerp( ef1.valueSingle, ef2.valueSingle, blend ); break;
                        case "System.Boolean": resultField.valueBoolean = ef2.valueBoolean; break;
                        case "UnityEngine.Vector2": resultField.valueVector2 = Vector2.Lerp( ef1.valueVector2, ef2.valueVector2, blend ); break;
                        case "UnityEngine.Vector3": resultField.valueVector3 = Vector3.Lerp( ef1.valueVector3, ef2.valueVector3, blend ); break;
                        case "UnityEngine.Vector4": resultField.valueVector4 = Vector4.Lerp( ef1.valueVector4, ef2.valueVector4, blend ); break;
                        case "UnityEngine.Color": resultField.valueColor = Color.Lerp( ef1.valueColor, ef2.valueColor, blend ); break;
                    }

                    resultComp.fields.Add( resultField );
                }
            }
            resultVolume.components.Add( resultComp );
            }
            return resultVolume;
        }
Ejemplo n.º 9
0
        public void UpdateVolume()
        {
            if (this.gameObject == null)
            {
                return;
            }
            VolumeEffectFlags effectFlags = this.gameObject.EffectFlags;

            foreach (VolumeEffectComponentFlags current in effectFlags.components)
            {
                if (current.blendFlag)
                {
                    Component component = this.gameObject.GetComponent(current.componentName);
                    if (component != null)
                    {
                        this.AddComponent(component, current);
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public void UpdateVolume()
        {
            if (gameObject == null)
            {
                return;
            }

            VolumeEffectFlags effectFlags = gameObject.EffectFlags;

            foreach (VolumeEffectComponentFlags compFlags in effectFlags.components)
            {
                if (!compFlags.blendFlag)
                {
                    continue;
                }

                Component c = gameObject.GetComponent(compFlags.componentName);
                if (c != null)
                {
                    AddComponent(c, compFlags);
                }
            }
        }
Ejemplo n.º 11
0
        public void BlendValues(AmplifyColorBase targetColor, VolumeEffect other, float blendAmount)
        {
            VolumeEffectFlags effectFlags = targetColor.EffectFlags;
            GameObject        gameObject  = targetColor.gameObject;

            for (int i = 0; i < effectFlags.components.Count; i++)
            {
                VolumeEffectComponentFlags volumeEffectComponentFlags = effectFlags.components[i];
                if (volumeEffectComponentFlags.blendFlag)
                {
                    Component             component              = gameObject.GetComponent(volumeEffectComponentFlags.componentName);
                    VolumeEffectComponent volumeEffectComponent  = this.FindEffectComponent(volumeEffectComponentFlags.componentName);
                    VolumeEffectComponent volumeEffectComponent2 = other.FindEffectComponent(volumeEffectComponentFlags.componentName);
                    if (!(component == null) && volumeEffectComponent != null && volumeEffectComponent2 != null)
                    {
                        for (int j = 0; j < volumeEffectComponentFlags.componentFields.Count; j++)
                        {
                            VolumeEffectFieldFlags volumeEffectFieldFlags = volumeEffectComponentFlags.componentFields[j];
                            if (volumeEffectFieldFlags.blendFlag)
                            {
                                FieldInfo         field              = component.GetType().GetField(volumeEffectFieldFlags.fieldName);
                                VolumeEffectField volumeEffectField  = volumeEffectComponent.FindEffectField(volumeEffectFieldFlags.fieldName);
                                VolumeEffectField volumeEffectField2 = volumeEffectComponent2.FindEffectField(volumeEffectFieldFlags.fieldName);
                                if (field != null && volumeEffectField != null && volumeEffectField2 != null)
                                {
                                    string fullName = field.FieldType.FullName;
                                    if (fullName != null)
                                    {
                                        if (!(fullName == "System.Single"))
                                        {
                                            if (!(fullName == "System.Boolean"))
                                            {
                                                if (!(fullName == "UnityEngine.Vector2"))
                                                {
                                                    if (!(fullName == "UnityEngine.Vector3"))
                                                    {
                                                        if (!(fullName == "UnityEngine.Vector4"))
                                                        {
                                                            if (fullName == "UnityEngine.Color")
                                                            {
                                                                field.SetValue(component, Color.Lerp(volumeEffectField.valueColor, volumeEffectField2.valueColor, blendAmount));
                                                            }
                                                        }
                                                        else
                                                        {
                                                            field.SetValue(component, Vector4.Lerp(volumeEffectField.valueVector4, volumeEffectField2.valueVector4, blendAmount));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        field.SetValue(component, Vector3.Lerp(volumeEffectField.valueVector3, volumeEffectField2.valueVector3, blendAmount));
                                                    }
                                                }
                                                else
                                                {
                                                    field.SetValue(component, Vector2.Lerp(volumeEffectField.valueVector2, volumeEffectField2.valueVector2, blendAmount));
                                                }
                                            }
                                            else
                                            {
                                                field.SetValue(component, volumeEffectField2.valueBoolean);
                                            }
                                        }
                                        else
                                        {
                                            field.SetValue(component, Mathf.Lerp(volumeEffectField.valueSingle, volumeEffectField2.valueSingle, blendAmount));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 12
0
        public static VolumeEffect BlendValuesToVolumeEffect(VolumeEffectFlags flags, VolumeEffect volume1, VolumeEffect volume2, float blend)
        {
            VolumeEffect volumeEffect = new VolumeEffect(volume1.gameObject);

            foreach (VolumeEffectComponentFlags volumeEffectComponentFlags in flags.components)
            {
                if (volumeEffectComponentFlags.blendFlag)
                {
                    VolumeEffectComponent volumeEffectComponent  = volume1.FindEffectComponent(volumeEffectComponentFlags.componentName);
                    VolumeEffectComponent volumeEffectComponent2 = volume2.FindEffectComponent(volumeEffectComponentFlags.componentName);
                    if (volumeEffectComponent != null && volumeEffectComponent2 != null)
                    {
                        VolumeEffectComponent volumeEffectComponent3 = new VolumeEffectComponent(volumeEffectComponent.componentName);
                        foreach (VolumeEffectFieldFlags volumeEffectFieldFlags in volumeEffectComponentFlags.componentFields)
                        {
                            if (volumeEffectFieldFlags.blendFlag)
                            {
                                VolumeEffectField volumeEffectField  = volumeEffectComponent.FindEffectField(volumeEffectFieldFlags.fieldName);
                                VolumeEffectField volumeEffectField2 = volumeEffectComponent2.FindEffectField(volumeEffectFieldFlags.fieldName);
                                if (volumeEffectField != null && volumeEffectField2 != null)
                                {
                                    VolumeEffectField volumeEffectField3 = new VolumeEffectField(volumeEffectField.fieldName, volumeEffectField.fieldType);
                                    string            fieldType          = volumeEffectField3.fieldType;
                                    if (fieldType != null)
                                    {
                                        if (!(fieldType == "System.Single"))
                                        {
                                            if (!(fieldType == "System.Boolean"))
                                            {
                                                if (!(fieldType == "UnityEngine.Vector2"))
                                                {
                                                    if (!(fieldType == "UnityEngine.Vector3"))
                                                    {
                                                        if (!(fieldType == "UnityEngine.Vector4"))
                                                        {
                                                            if (fieldType == "UnityEngine.Color")
                                                            {
                                                                volumeEffectField3.valueColor = Color.Lerp(volumeEffectField.valueColor, volumeEffectField2.valueColor, blend);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            volumeEffectField3.valueVector4 = Vector4.Lerp(volumeEffectField.valueVector4, volumeEffectField2.valueVector4, blend);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        volumeEffectField3.valueVector3 = Vector3.Lerp(volumeEffectField.valueVector3, volumeEffectField2.valueVector3, blend);
                                                    }
                                                }
                                                else
                                                {
                                                    volumeEffectField3.valueVector2 = Vector2.Lerp(volumeEffectField.valueVector2, volumeEffectField2.valueVector2, blend);
                                                }
                                            }
                                            else
                                            {
                                                volumeEffectField3.valueBoolean = volumeEffectField2.valueBoolean;
                                            }
                                        }
                                        else
                                        {
                                            volumeEffectField3.valueSingle = Mathf.Lerp(volumeEffectField.valueSingle, volumeEffectField2.valueSingle, blend);
                                        }
                                    }
                                    volumeEffectComponent3.fields.Add(volumeEffectField3);
                                }
                            }
                        }
                        volumeEffect.components.Add(volumeEffectComponent3);
                    }
                }
            }
            return(volumeEffect);
        }
Ejemplo n.º 13
0
        public void SetValues(AmplifyColorBase targetColor)
        {
            VolumeEffectFlags effectFlags = targetColor.EffectFlags;
            GameObject        gameObject  = targetColor.gameObject;

            foreach (VolumeEffectComponentFlags volumeEffectComponentFlags in effectFlags.components)
            {
                if (volumeEffectComponentFlags.blendFlag)
                {
                    Component             component             = gameObject.GetComponent(volumeEffectComponentFlags.componentName);
                    VolumeEffectComponent volumeEffectComponent = this.FindEffectComponent(volumeEffectComponentFlags.componentName);
                    if (!(component == null) && volumeEffectComponent != null)
                    {
                        foreach (VolumeEffectFieldFlags volumeEffectFieldFlags in volumeEffectComponentFlags.componentFields)
                        {
                            if (volumeEffectFieldFlags.blendFlag)
                            {
                                FieldInfo         field             = component.GetType().GetField(volumeEffectFieldFlags.fieldName);
                                VolumeEffectField volumeEffectField = volumeEffectComponent.FindEffectField(volumeEffectFieldFlags.fieldName);
                                if (field != null && volumeEffectField != null)
                                {
                                    string fullName = field.FieldType.FullName;
                                    if (fullName != null)
                                    {
                                        if (!(fullName == "System.Single"))
                                        {
                                            if (!(fullName == "System.Boolean"))
                                            {
                                                if (!(fullName == "UnityEngine.Vector2"))
                                                {
                                                    if (!(fullName == "UnityEngine.Vector3"))
                                                    {
                                                        if (!(fullName == "UnityEngine.Vector4"))
                                                        {
                                                            if (fullName == "UnityEngine.Color")
                                                            {
                                                                field.SetValue(component, volumeEffectField.valueColor);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            field.SetValue(component, volumeEffectField.valueVector4);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        field.SetValue(component, volumeEffectField.valueVector3);
                                                    }
                                                }
                                                else
                                                {
                                                    field.SetValue(component, volumeEffectField.valueVector2);
                                                }
                                            }
                                            else
                                            {
                                                field.SetValue(component, volumeEffectField.valueBoolean);
                                            }
                                        }
                                        else
                                        {
                                            field.SetValue(component, volumeEffectField.valueSingle);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 14
0
        }                                                       // 0x0085B900-0x0085B990

        // Methods
        public static VolumeEffect BlendValuesToVolumeEffect(VolumeEffectFlags flags, VolumeEffect volume1, VolumeEffect volume2, float blend) => default; // 0x0085B990-0x0085C1A0