namespace UnityEngine.XR.Interaction.Toolkit.Inputs.Haptics
{
///
/// Haptic impulse channel group that wraps a single channel instance.
/// This class provides a convenient way to create a channel group with a single channel known at time of construction.
///
public class HapticImpulseSingleChannelGroup : IXRHapticImpulseChannelGroup
{
///
public int channelCount => 1;
///
/// The single haptic impulse channel the group contains.
///
public IXRHapticImpulseChannel impulseChannel { get; }
///
/// Initializes and returns an instance of .
///
/// The single haptic impulse channel the group contains.
public HapticImpulseSingleChannelGroup(IXRHapticImpulseChannel channel)
{
impulseChannel = channel;
}
///
public IXRHapticImpulseChannel GetChannel(int channel = 0)
{
if (channel < 0)
{
Debug.LogError("Haptic channel can't be negative.");
return null;
}
return impulseChannel;
}
}
}