// Animancer // https://kybernetik.com.au/animancer // Copyright 2018-2023 Kybernetik // using System; using UnityEngine; namespace Animancer { /// [Pro-Only] A which manages one float parameter. /// /// Documentation: Animator Controllers /// /// /// /// https://kybernetik.com.au/animancer/api/Animancer/Float1ControllerState /// public class Float1ControllerState : ControllerState { /************************************************************************************************************************/ /// An that creates a . public new interface ITransition : ITransition { } /************************************************************************************************************************/ private ParameterID _ParameterID; /// The identifier of the parameter which will get and set. public new ParameterID ParameterID { get => _ParameterID; set { _ParameterID = value; _ParameterID.ValidateHasParameter(Controller, AnimatorControllerParameterType.Float); } } /// /// Gets and sets a float parameter in the using the /// . /// /// The value is NaN or Infinity. public float Parameter { get => Playable.GetFloat(_ParameterID.Hash); set { AssertParameterValue(value); Playable.SetFloat(_ParameterID.Hash, value); } } /************************************************************************************************************************/ /// Creates a new to play the `controller`. public Float1ControllerState(RuntimeAnimatorController controller, ParameterID parameter, params ActionOnStop[] actionsOnStop) : base(controller, actionsOnStop) { _ParameterID = parameter; _ParameterID.ValidateHasParameter(controller, AnimatorControllerParameterType.Float); } /// Creates a new to play the `controller`. public Float1ControllerState(RuntimeAnimatorController controller, ParameterID parameter) : this(controller, parameter, null) { } /************************************************************************************************************************/ /// public override int ParameterCount => 1; /// public override int GetParameterHash(int index) => _ParameterID; /************************************************************************************************************************/ /// public override AnimancerState Clone(AnimancerPlayable root) { var clone = new Float1ControllerState(Controller, _ParameterID); clone.SetNewCloneRoot(root); ((ICopyable)clone).CopyFrom(this); return clone; } /************************************************************************************************************************/ } }