using System; using SLSUtilities.General; using UnityEngine; using UnityEngine.Events; namespace SLSUtilities.General { public class PrioritizedAction : IPrioritized { private readonly Action action; public int Priority { get; set; } public PrioritizedAction(Action action, int priority = 0) { this.action = action; this.Priority = priority; } public void Invoke() { action.Invoke(); } } public class PrioritizedAction : IPrioritized { private readonly Action action; public int Priority { get; set; } public PrioritizedAction(Action action, int priority = 0) { this.action = action; this.Priority = priority; } public void Invoke(T arg) { action.Invoke(arg); } } public class PrioritizedAction : IPrioritized { private readonly Action action; public int Priority { get; set; } public PrioritizedAction(Action action, int priority = 0) { this.action = action; this.Priority = priority; } public void Invoke(T1 arg1, T2 arg2) { action.Invoke(arg1, arg2); } } public class PrioritizedAction : IPrioritized { private readonly Action action; public int Priority { get; set; } public PrioritizedAction(Action action, int priority = 0) { this.action = action; this.Priority = priority; } public void Invoke(T1 arg1, T2 arg2, T3 arg3) { action.Invoke(arg1, arg2, arg3); } } public class PrioritizedFunc : IPrioritized { private readonly Func func; public int Priority { get; set; } public PrioritizedFunc(Func func, int priority = 0) { this.func = func; this.Priority = priority; } public TR Invoke() { return func.Invoke(); } } public class PrioritizedFunc : IPrioritized { private readonly Func func; public int Priority { get; set; } public PrioritizedFunc(Func func, int priority = 0) { this.func = func; this.Priority = priority; } public TR Invoke(T arg) { return func.Invoke(arg); } } public class PrioritizedFunc : IPrioritized { private readonly Func func; public int Priority { get; set; } public PrioritizedFunc(Func func, int priority = 0) { this.func = func; this.Priority = priority; } public TR Invoke(T1 arg1, T2 arg2) { return func.Invoke(arg1, arg2); } } public class PrioritizedFunc : IPrioritized { private readonly Func func; public int Priority { get; set; } public PrioritizedFunc(Func func, int priority = 0) { this.func = func; this.Priority = priority; } public TR Invoke(T1 arg1, T2 arg2, T3 arg3) { return func.Invoke(arg1, arg2, arg3); } } public class PrioritizedCheckAndEffect : IPrioritized { public readonly Func check; public readonly Action effect; public int Priority { get; set; } public PrioritizedCheckAndEffect(Func check, Action effect, int priority = 0) { this.check = check; this.effect = effect; this.Priority = priority; } public void Invoke() { if (check.Invoke()) { effect.Invoke(); } } } }