// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Microsoft.MixedReality.Toolkit.Utilities; using System; using UnityEngine; namespace Microsoft.MixedReality.Toolkit.Input { /// /// Maps the capabilities of controllers, defining the physical inputs of a controller. /// /// /// One definition should exist for each physical device input, such as buttons, triggers, joysticks, dpads, etc. /// [Serializable] public class MixedRealityInputActionMapping { /// /// The constructor for a new MixedRealityInputActionMapping definition /// /// The description of the interaction mapping. /// The logical MixedRealityInputAction that this input performs public MixedRealityInputActionMapping(string description, AxisType axisType, DeviceInputType inputType) : this(description, axisType, inputType, MixedRealityInputAction.None) { } /// /// The constructor for a new MixedRealityInputActionMapping definition /// /// The description of the interaction mapping. /// The logical MixedRealityInputAction that this input performs public MixedRealityInputActionMapping(string description, AxisType axisType, DeviceInputType inputType, MixedRealityInputAction inputAction) { this.description = description; this.axisType = axisType; this.inputType = inputType; this.inputAction = inputAction; } [SerializeField] [Tooltip("The description of the interaction mapping.")] private string description; /// /// The description of the input action mapping. /// public string Description => description; [SerializeField] [Tooltip("The axis type of the button, e.g. Analogue, Digital, etc.")] private AxisType axisType; /// /// The axis type of the button, e.g. Analog, Digital, etc. /// public AxisType AxisType => axisType; [SerializeField] [Tooltip("The primary action of the input as defined by the controller SDK.")] private DeviceInputType inputType; /// /// The primary action of the input as defined by the controller SDK. /// public DeviceInputType InputType => inputType; [SerializeField] [Tooltip("Action to be raised to the Input Manager when the input data has changed.")] private MixedRealityInputAction inputAction; /// /// Action to be raised when the input data has changed. /// public MixedRealityInputAction InputAction { get { return inputAction; } internal set { inputAction = value; } } } }