// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2024 Kybernetik //
#if UNITY_EDITOR
using UnityEngine;
namespace Animancer.Editor
{
/// [Editor-Only]
/// for .
///
/// https://kybernetik.com.au/animancer/api/Animancer.Editor/AnimancerGraphSpeedSlider
public class AnimancerGraphSpeedSlider : ToggledSpeedSlider
{
/************************************************************************************************************************/
/// Singleton.
public static readonly AnimancerGraphSpeedSlider
Instance = new();
/// The target graph.
public AnimancerGraph Graph { get; set; }
/************************************************************************************************************************/
/// Creates a new .
public AnimancerGraphSpeedSlider()
: base(nameof(AnimancerGraphSpeedSlider) + ".Show")
{
}
/************************************************************************************************************************/
///
protected override void OnSetSpeed(float speed)
{
if (Graph != null)
Graph.Speed = speed;
}
/************************************************************************************************************************/
///
public override bool DoToggleGUI(Rect area, GUIStyle style)
{
if (Graph != null)
Speed = Graph.Speed;
return base.DoToggleGUI(area, style);
}
/************************************************************************************************************************/
}
}
#endif