/// <summary> /// Start the tweening operation. /// </summary> static public TweenVolume Begin(GameObject go, float duration, float targetVolume) { TweenVolume comp = UITweener.Begin <TweenVolume>(go, duration); comp.from = comp.value; comp.to = targetVolume; if (targetVolume > 0f) { var s = comp.audioSource; s.enabled = true; s.Play(); } return(comp); }
public override void OnInspectorGUI() { GUILayout.Space(6f); TweenKitEditorTools.SetLabelWidth(120f); TweenVolume tw = target as TweenVolume; GUI.changed = false; float from = EditorGUILayout.Slider("From", tw.from, 0f, 1f); float to = EditorGUILayout.Slider("To", tw.to, 0f, 1f); if (GUI.changed) { TweenKitEditorTools.RegisterUndo("Tween Change", tw); tw.from = from; tw.to = to; TweenKitTools.SetDirty(tw); } DrawCommonProperties(); }