43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
public class ExaminableItemRegularEvent : MonoBehaviour
|
|
{
|
|
public UnityEvent eventToFireWhenStartExaminingItem;
|
|
public UnityEvent eventToFireWhenStopExaminingItem;
|
|
|
|
public bool doEventOnceWhenStartExamining;
|
|
public bool doEventOnceWhenStopExamining;
|
|
|
|
private bool canInvokeEventWhenStartExamining = true;
|
|
public bool canInvokeEventWhenStopExamining = true;
|
|
|
|
public void InvokeWhenStartExamining()
|
|
{
|
|
if (canInvokeEventWhenStartExamining)
|
|
{
|
|
eventToFireWhenStartExaminingItem.Invoke();
|
|
print("Start Examine Event invoked");
|
|
if (doEventOnceWhenStartExamining)
|
|
{
|
|
canInvokeEventWhenStartExamining = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void InvokeWhenStopExamining()
|
|
{
|
|
if (canInvokeEventWhenStopExamining)
|
|
{
|
|
eventToFireWhenStopExaminingItem.Invoke();
|
|
print("Stop Examine Event invoked");
|
|
if (doEventOnceWhenStopExamining)
|
|
{
|
|
canInvokeEventWhenStopExamining = false;
|
|
}
|
|
}
|
|
}
|
|
}
|