60 lines
1.3 KiB
C#
60 lines
1.3 KiB
C#
using SLSFramework.General;
|
|
using UnityEngine;
|
|
using UnityEngine.Events;
|
|
|
|
|
|
namespace SLSFramework.General
|
|
{
|
|
public class EventUnit : IPrioritized
|
|
{
|
|
private readonly UnityAction action;
|
|
public int Priority { get; set; }
|
|
|
|
public EventUnit(UnityAction action, int priority = 0)
|
|
{
|
|
this.action = action;
|
|
this.Priority = priority;
|
|
}
|
|
|
|
public void Invoke()
|
|
{
|
|
action.Invoke();
|
|
}
|
|
}
|
|
|
|
public class EventUnit<T> : IPrioritized
|
|
{
|
|
private readonly UnityAction<T> action;
|
|
public int Priority { get; set; }
|
|
|
|
public EventUnit(UnityAction<T> action, int priority = 0)
|
|
{
|
|
this.action = action;
|
|
this.Priority = priority;
|
|
}
|
|
|
|
public void Invoke(T arg)
|
|
{
|
|
action.Invoke(arg);
|
|
}
|
|
}
|
|
|
|
public class EventUnit<T1, T2> : IPrioritized
|
|
{
|
|
private readonly UnityAction<T1, T2> action;
|
|
public int Priority { get; set; }
|
|
|
|
public EventUnit(UnityAction<T1, T2> action, int priority = 0)
|
|
{
|
|
this.action = action;
|
|
this.Priority = priority;
|
|
}
|
|
|
|
public void Invoke(T1 arg1, T2 arg2)
|
|
{
|
|
action.Invoke(arg1, arg2);
|
|
}
|
|
}
|
|
}
|
|
|