// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) VRMADA, All rights reserved.
//
// --------------------------------------------------------------------------------------------------------------------
using System;
using UltimateXR.Core;
using UltimateXR.Haptics;
namespace UltimateXR.Devices
{
///
/// Wraps information about a haptic request event.
///
public class UxrControllerHapticEventArgs : EventArgs
{
#region Public Types & Data
///
/// Gets the haptic clip if the event is .
///
public UxrHapticClip HapticClip { get; }
///
/// Gets the haptic feedback raw frequency if the event is .
///
public float Frequency { get; }
///
/// Gets the haptic feedback raw amplitude if the event is .
///
public float Amplitude { get; }
///
/// Gets the haptic feedback duration in seconds if the event is .
///
public float DurationSeconds { get; }
///
/// Gets the haptic feedback playback mode.
///
public UxrHapticMode HapticMode { get; }
///
/// Gets the haptic feedback target hand.
///
public UxrHandSide HandSide { get; private set; }
///
/// Gets the haptic event type.
///
public UxrHapticEventType HapticEventType { get; private set; }
#endregion
#region Constructors & Finalizer
///
/// Constructor that registers a event.
///
/// Haptic feedback target hand
/// Clip that was requested
public UxrControllerHapticEventArgs(UxrHandSide handSide, UxrHapticClip clip)
{
HandSide = handSide;
HapticEventType = UxrHapticEventType.Clip;
HapticClip = clip;
}
///
/// Constructor that registers a event.
///
/// Haptic feedback target hand
/// Vibration frequency
/// Vibration amplitude
/// Feedback duration in seconds
/// Haptic mode: mix or replace
public UxrControllerHapticEventArgs(UxrHandSide handSide, float frequency, float amplitude, float durationSeconds, UxrHapticMode hapticMode)
{
HapticEventType = UxrHapticEventType.Raw;
HandSide = handSide;
Frequency = frequency;
Amplitude = amplitude;
DurationSeconds = durationSeconds;
HapticMode = hapticMode;
}
///
/// Default constructor is private
///
private UxrControllerHapticEventArgs()
{
}
#endregion
#region Public Methods
///
/// Generates a event for the given hand
///
/// Haptic feedback target hand
public static UxrControllerHapticEventArgs GetHapticStopEvent(UxrHandSide handSide)
{
return new UxrControllerHapticEventArgs
{
HapticEventType = UxrHapticEventType.Stop,
HandSide = handSide
};
}
#endregion
}
}