Trigger/Trigger.cs

26 lines
554 B
C#
Raw Normal View History

2022-11-14 12:15:32 +03:00
using System;
using UnityEngine;
namespace Syntriax.Modules.Trigger
{
public class Trigger : MonoBehaviour, ITrigger
{
public Action<bool> OnTriggered { get; set; } = null;
private bool _isTrigerred = false;
2022-11-14 12:15:32 +03:00
public bool IsTrigerred
{
get => _isTrigerred;
protected set
{
bool oldValue = _isTrigerred;
_isTrigerred = value;
if (oldValue != value)
OnTriggered?.Invoke(value);
}
}
}
}