コード例 #1
0
        SerializedProperty GetValueProperty(AudioOption.Types type, bool hasCurve, SerializedObject dummy)
        {
            var propertyName  = type.ToString() + (hasCurve ? "Curve" : "");
            var valueProperty = dummy.FindProperty(propertyName);

            return(valueProperty);
        }
コード例 #2
0
        void InitializeValue(AudioOption.Types type)
        {
            if (dynamicValue.IsArray || (dynamicValue.Type == DynamicValue.ValueTypes.Null && dynamicValue.Value == null))
            {
                dynamicValue.Value = AudioOption.GetDefaultValue(type);
            }

            if (type == AudioOption.Types.VolumeScale || type == AudioOption.Types.PitchScale)
            {
                var data = audioOption.GetValue <Vector3>();

                valueProperty.SetValue(data.x);
                timeProperty.SetValue(data.y);
                easeProperty.SetValue((TweenUtility.Ease)data.z);
            }
            else if (type == AudioOption.Types.FadeIn || type == AudioOption.Types.FadeOut)
            {
                var data = audioOption.GetValue <Vector2>();

                valueProperty.SetValue(data.x);
                easeProperty.SetValue((TweenUtility.Ease)data.y);
            }
            else
            {
                valueProperty.SetValue(dynamicValue.Value);
            }
        }
コード例 #3
0
 bool CanHaveCurve(AudioOption.Types type)
 {
     return
         (type == AudioOption.Types.SpatialBlend ||
          type == AudioOption.Types.ReverbZoneMix ||
          type == AudioOption.Types.Spread ||
          type == AudioOption.Types.RolloffMode);
 }
コード例 #4
0
 bool HasCurve(AudioOption.Types type, object value)
 {
     return
         (type == AudioOption.Types.SpatialBlend ||
          type == AudioOption.Types.ReverbZoneMix ||
          type == AudioOption.Types.Spread ||
          (type == AudioOption.Types.RolloffMode && (AudioRolloffMode)value == AudioRolloffMode.Custom));
 }
コード例 #5
0
        SerializedProperty GetCurveProperty(AudioOption.Types type, object value, SerializedProperty property)
        {
            SerializedProperty curveProperty = null;

            if (HasCurve(type, value))
            {
                curveProperty = property.FindPropertyRelative("curve");
            }

            return(curveProperty);
        }
コード例 #6
0
        SerializedProperty GetEaseProperty(AudioOption.Types type, SerializedObject dummy)
        {
            SerializedProperty easeProperty = null;

            if (type == AudioOption.Types.VolumeScale || type == AudioOption.Types.PitchScale || type == AudioOption.Types.FadeIn || type == AudioOption.Types.FadeOut)
            {
                easeProperty = dummy.FindProperty("EaseType");
            }

            return(easeProperty);
        }
コード例 #7
0
        SerializedProperty GetTimeProperty(AudioOption.Types type, SerializedObject dummy)
        {
            SerializedProperty timeProperty = null;

            if (type == AudioOption.Types.VolumeScale || type == AudioOption.Types.PitchScale)
            {
                timeProperty = dummy.FindProperty("EaseTime");
            }

            return(timeProperty);
        }
コード例 #8
0
        void SetValue(AudioOption.Types type, bool hasCurve)
        {
            serializedObject.ApplyModifiedProperties();

            var valueType = AudioOption.ToValueType(type, hasCurve);

            dynamicValue.SetType(valueType, isArray);

            if (type == AudioOption.Types.VolumeScale || type == AudioOption.Types.PitchScale)
            {
                dynamicValue.Value = new Vector3(valueProperty.GetValue <float>(), timeProperty.GetValue <float>(), (float)easeProperty.GetValue <TweenUtility.Ease>());
            }
            else if (type == AudioOption.Types.FadeIn || type == AudioOption.Types.FadeOut)
            {
                dynamicValue.Value = new Vector2(valueProperty.GetValue <float>(), (float)easeProperty.GetValue <TweenUtility.Ease>());
            }
            else
            {
                dynamicValue.Value = valueProperty.GetValue();
            }

            dynamicValue.Serialize();
            serializedObject.Update();
        }