123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.InputSystem;
- namespace SC.XR.Unity.Simulation {
-
-
-
-
-
-
-
-
-
- public class InputActionManager : MonoBehaviour
- {
- [SerializeField]
- [Tooltip("Input action assets to affect when inputs are enabled or disabled.")]
- List<InputActionAsset> m_ActionAssets;
-
-
-
- public List<InputActionAsset> actionAssets
- {
- get => m_ActionAssets;
- set => m_ActionAssets = value ?? throw new ArgumentNullException(nameof(value));
- }
- protected void OnEnable()
- {
- EnableInput();
- }
- protected void OnDisable()
- {
- DisableInput();
- }
-
-
-
-
-
-
-
-
-
-
-
- public void EnableInput()
- {
- if (m_ActionAssets == null)
- return;
- foreach (var actionAsset in m_ActionAssets)
- {
- if (actionAsset != null)
- {
- actionAsset.Enable();
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
-
- public void DisableInput()
- {
- if (m_ActionAssets == null)
- return;
- foreach (var actionAsset in m_ActionAssets)
- {
- if (actionAsset != null)
- {
- actionAsset.Disable();
- }
- }
- }
- }
- }
|