27 lines
809 B
C#
27 lines
809 B
C#
using UnityEngine;
|
||
|
||
public static class In
|
||
{
|
||
static AbstractInputSource CachedSource;
|
||
public static void Initialize(AbstractInputSource inputSource)
|
||
{
|
||
#if !UNITY_EDITOR
|
||
CachedSource = new ComInput();
|
||
#else
|
||
CachedSource = inputSource;
|
||
#endif
|
||
|
||
var success = CachedSource.Initialize();
|
||
if (!success) Debug.LogWarning("Не удалось проинициалзировать источник управления.");
|
||
}
|
||
|
||
|
||
public static bool GetButton(InSignal button) => CachedSource.GetButton(button);
|
||
|
||
public static bool GetButtonDown(InSignal button) => CachedSource.GetButtonDown(button);
|
||
|
||
public static bool GetButtonUp(InSignal button) => CachedSource.GetButtonUp(button);
|
||
|
||
|
||
public static bool AnyButton() => CachedSource.AnyButton();
|
||
} |