Files
2026-07-21 08:56:10 +03:00

39 lines
1.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InputProviderManager : MonoBehaviour
{
private static InputProviderManager instance;
private BaseInputProvider currentInputProvider;
private void Awake()
{
if (instance == null) instance = this;
else Destroy(this.gameObject);
// check the current platform and determine which Provider to use
currentInputProvider = Application.isMobilePlatform ?
gameObject.GetComponentInChildren<MobileInputProvider>() :
gameObject.GetComponentInChildren<PCIntputProvider>();
// disable all InputProviders
BaseInputProvider[] inputProviders = GetComponentsInChildren<BaseInputProvider>();
foreach (BaseInputProvider inputProvider in inputProviders)
inputProvider.Disable();
currentInputProvider.Enable();
}
public static InputProviderManager getInstance()
{
return instance;
}
public BaseInputProvider getCurrentInputProvider()
{
return currentInputProvider;
}
}