Exemplo n.º 1
0
        private void Apply(ScreenSpaceReflection.SSRSettings settings)
        {
            foreach (var fieldKVP in m_PropertyMap)
            {
                var value     = fieldKVP.Key.GetValue(settings);
                var fieldType = fieldKVP.Key.FieldType;

                if (fieldType == typeof(float))
                {
                    fieldKVP.Value.Value.floatValue = (float)value;
                }
                else if (fieldType == typeof(bool))
                {
                    fieldKVP.Value.Value.boolValue = (bool)value;
                }
                else if (fieldType == typeof(int))
                {
                    fieldKVP.Value.Value.intValue = (int)value;
                }
                else if (fieldType.IsEnum)
                {
                    fieldKVP.Value.Value.enumValueIndex = (int)value;
                }
                else
                {
                    Debug.LogErrorFormat("Encounted unexpected type {0} in application of settings", fieldKVP.Key.FieldType);
                }
            }
        }
Exemplo n.º 2
0
        private void Apply(ScreenSpaceReflection.SSRSettings settings)
        {
            var validTargets = targets.Where(x => x is ScreenSpaceReflection).Cast <ScreenSpaceReflection>().ToArray();

            Undo.RecordObjects(validTargets, "Apply SSR Settings");
            foreach (var validTarget in validTargets)
            {
                validTarget.settings = settings;
            }
        }