using Invector.vCharacterController; using UnityEngine; using UnityEngine.EventSystems; using System.Collections; using UnityEngine.UI; using UnityStandardAssets.CrossPlatformInput; namespace Beyond { public class ButtonHandler : MonoBehaviour { public string Name; public void SetDownState() { CrossPlatformInputManager.SetButtonDown(Name); } public void Click() { StartCoroutine(OnClick()); } private IEnumerator OnClick() { SetDownState(); yield return new WaitForEndOfFrame(); SetUpState(); } public void SetUpState() { CrossPlatformInputManager.SetButtonUp(Name); } public void SetAxisPositiveState() { CrossPlatformInputManager.SetAxisPositive(Name); } public void SetAxisNeutralState() { CrossPlatformInputManager.SetAxisZero(Name); } public void SetAxisNegativeState() { CrossPlatformInputManager.SetAxisNegative(Name); } } /* [AddComponentMenu("Input/ButtonHandler")] public class ButtonHandler : OnScreenControl { [HideInInspector] public GenericInput action; [Header("Name is deprecated")] [Tooltip("The name is deprecated, use Control path instead.")] public string Name; [InputControl(layout = "Button")] [SerializeField] private string m_ControlPath; private Button button; protected override string controlPathInternal { get => m_ControlPath; set => m_ControlPath = value; } public void SetAxisPositiveState() { CrossPlatformInputManager.SetAxisPositive(Name); } public void SetAxisNeutralState() { CrossPlatformInputManager.SetAxisZero(Name); } public void SetAxisNegativeState() { CrossPlatformInputManager.SetAxisNegative(Name); } public void Click() { StartCoroutine(OnClick()); } private IEnumerator OnClick() { SetDownState(); yield return new WaitForEndOfFrame(); SetUpState(); } private void Awake() { if(m_ControlPath == null) { Debug.Log("Null"); } button = GetComponent