UP-Viagg-io/Viagg-io/Assets/afca/ViaggioAI/Scripts/ViaggioAI/ControllerInputEventHandler.cs

84 lines
1.6 KiB
C#
Executable File

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class ControllerInputEventHandler : MonoBehaviour
{
#region Inspector Properties
[Header("Events")]
[SerializeField]
private UnityEvent onIndexTriggerPulled;
[SerializeField]
private UnityEvent onAButtonPushed;
[SerializeField]
private UnityEvent onBButtonPushed;
[SerializeField]
private UnityEvent onXButtonPushed;
[SerializeField]
private UnityEvent onYButtonPushed;
#endregion
#region Public Properties
#endregion
#region Private Properties
#endregion
#region Framework Functions
void Update()
{
this.checkForInput();
}
#endregion
#region Events
#endregion
#region Public Functions
#endregion
#region Private Functions
private void checkForInput()
{
if (OVRInput.GetDown(OVRInput.RawButton.LIndexTrigger) || OVRInput.GetDown(OVRInput.RawButton.RIndexTrigger))
{
this.onIndexTriggerPulled.Invoke();
}
if (OVRInput.GetDown(OVRInput.RawButton.A))
{
this.onAButtonPushed.Invoke();
}
if (OVRInput.GetDown(OVRInput.RawButton.B))
{
this.onBButtonPushed.Invoke();
}
if (OVRInput.GetDown(OVRInput.RawButton.X))
{
this.onXButtonPushed.Invoke();
}
if (OVRInput.GetDown(OVRInput.RawButton.Y))
{
this.onYButtonPushed.Invoke();
}
}
#endregion
}