using UnityEngine;
using System;
///
/// MonoBehaviour that immediately completes an interaction when started.
///
public class OneClickInteraction : MonoBehaviour
{
private Interactable interactable;
void Awake()
{
interactable = GetComponent();
if (interactable != null)
{
interactable.StartedInteraction += OnStartedInteraction;
}
}
void OnDestroy()
{
if (interactable != null)
{
interactable.StartedInteraction -= OnStartedInteraction;
}
}
private void OnStartedInteraction()
{
if (interactable != null)
{
interactable.CompleteInteraction(true);
}
}
}