using System;
using Chernobyl.Unity.Event;
using UnityEngine;
namespace Chernobyl.Unity.Input
{
///
/// Triggers instances when associated buttons are pressed down.
///
public class ButtonDownMonitor : MonoBehaviour
{
///
/// The name of the button to check when it is pressed down.
///
[Tooltip("The list buttons to check when it is pressed down.")]
public NameEventSource[] Triggers;
/// See Unity docs for more info.
public void Update()
{
foreach (var trigger in Triggers)
{
if (UnityEngine.Input.GetButtonDown(trigger.Name))
trigger.EventSource.Subject.OnNext(EventArgs.Empty);
}
}
}
}