// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) VRMADA, All rights reserved. // // -------------------------------------------------------------------------------------------------------------------- using System; using UltimateXR.Devices; using UltimateXR.Manipulation.HandPoses; using UnityEngine; namespace UltimateXR.Avatar.Controllers { /// /// Describes an event that maps an XR controller input to a hand pose. This allows to show different poses when /// certain buttons are pressed. It also allows to describe which poses need to be used when grabbing or pointing /// with the finger. /// [Serializable] public class UxrAvatarControllerEvent { #region Inspector Properties/Serialized Fields [SerializeField] private UxrInputButtons _buttons; [SerializeField] private UxrAnimationType _animationType; [SerializeField] private UxrHandPoseAsset _handPose; [SerializeField] [Range(0.0f, 1.0f)] private float _poseBlendValue; #endregion #region Public Types & Data /// /// Gets the hand pose name that should be used on the event. /// public string PoseName => string.IsNullOrEmpty(_poseNameOverride) ? _handPose != null ? _handPose.name : null : _poseNameOverride; /// /// Gets or sets the button(s) that trigger the animation event. /// public UxrInputButtons Buttons { get => _buttons; set => _buttons = value; } /// /// Gets the type of animation the event represents. This allows to keep track of certain key animations such as /// grabbing or pointing with the finger, that are used in the framework. /// public UxrAnimationType TypeOfAnimation { get => _animationType; set => _animationType = value; } /// /// Gets or sets the pose name that will be used instead of the pose stored. If null, the pose will be used instead. /// public string PoseNameOverride { get => _poseNameOverride; set => _poseNameOverride = value; } /// /// Gets or sets the pose blend value if the pose is . /// public float PoseBlendValue { get => _poseBlendValue; set => _poseBlendValue = value; } #endregion #region Public Overrides object /// public override string ToString() { return $"Event type: {_animationType}, button(s): {_buttons}, pose: {PoseName}, blend: {_poseBlendValue}"; } #endregion #region Private Types & Data private string _poseNameOverride; #endregion } }