27 lines
634 B
C#
27 lines
634 B
C#
using UnityEngine;
|
|
|
|
public class InteractionHandler : MonoBehaviour
|
|
{
|
|
public static InteractionHandler Instance { get; private set; }
|
|
|
|
public delegate void OnObjectInteracted(GameObject interactedObject);
|
|
public event OnObjectInteracted onObjectInteracted;
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance == null)
|
|
{
|
|
Instance = this;
|
|
DontDestroyOnLoad(gameObject);
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
|
|
public void NotifyInteraction(GameObject interactedObject)
|
|
{
|
|
onObjectInteracted?.Invoke(interactedObject);
|
|
}
|
|
} |