15 internal static class LinqExtension
18 internal static void ForEach<T>(
this IEnumerable<T> enumeration, System.Action<T> action)
20 foreach (T item
in enumeration)
28 internal static class HapticDeviceManager
31 private static Dictionary<System.Type,
object> m_haptic_providers =
new Dictionary<System.Type,
object>();
33 public static void DeviceInitLoop()
35 ReflectionNames.GetCompatibleAssemblies().ForEach(assembly => {
36 assembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(
IHapticProvider))).ForEach(hapticProviderType => {
37 object instance = System.Activator.CreateInstance(hapticProviderType);
44 if ((
bool)hapticProviderType.GetMethod(ReflectionNames.INIT_PROVIDER_METHOD_NAME)?.Invoke(instance,
null))
46 m_haptic_providers.Add(hapticProviderType, instance);
52 public static void DeviceRenderLoop()
54 m_haptic_providers.ForEach(provider => {
56 if ((
bool)provider.Key.GetMethod(ReflectionNames.IS_PRESENT_PROVIDER_METHOD_NAME)?.Invoke(provider.Value,
null))
59 provider.Key.GetMethod(ReflectionNames.RENDER_HAPTICS_PROVIDER_METHOD_NAME)?.Invoke(provider.Value, null);
64 public static void DeviceCleanLoop()
66 m_haptic_providers.ForEach(provider => {
68 provider.Key.GetMethod(ReflectionNames.CLEAN_PROVIDER_METHOD_NAME)?.Invoke(provider.Value,
null);