using UnityEngine;
using System;
using Input;
using Interactions;
///
/// MonoBehaviour that immediately completes an interaction when started.
///
public class OneClickInteraction : MonoBehaviour
{
private Interactable interactable;
void Awake()
{
interactable = GetComponent();
if (interactable != null)
{
interactable.interactionStarted.AddListener(OnInteractionStarted);
}
}
void OnDestroy()
{
if (interactable != null)
{
interactable.interactionStarted.RemoveListener(OnInteractionStarted);
}
}
private void OnInteractionStarted(PlayerTouchController playerRef, FollowerController followerRef)
{
if (interactable != null)
{
interactable.BroadcastInteractionComplete(true);
}
}
}