37 lines
1.8 KiB
C#
37 lines
1.8 KiB
C#
using System;
|
|
|
|
namespace Utils
|
|
{
|
|
public static class App
|
|
{
|
|
public static event Action Update;
|
|
public static event Action LateUpdate;
|
|
public static event Action EarlyUpdate;
|
|
public static event Action LastUpdate;
|
|
public static event Action FixedUpdate;
|
|
|
|
internal static void InvokeUpdate() => Update?.Invoke();
|
|
internal static void InvokeLateUpdate() => LateUpdate?.Invoke();
|
|
internal static void InvokeEarlyUpdate() => EarlyUpdate?.Invoke();
|
|
internal static void InvokeLastUpdate() => LastUpdate?.Invoke();
|
|
internal static void InvokeFixedUpdate() => FixedUpdate?.Invoke();
|
|
|
|
internal static void ClearUpdate() => Update = null;
|
|
internal static void ClearLateUpdate() => LateUpdate = null;
|
|
internal static void ClearEarlyUpdate() => EarlyUpdate = null;
|
|
internal static void ClearLastUpdate() => LastUpdate = null;
|
|
internal static void ClearFixedUpdate() => FixedUpdate = null;
|
|
|
|
internal static Delegate[] UpdateDelegates => Update?.GetInvocationList();
|
|
internal static Delegate[] LateUpdateDelegates => LateUpdate?.GetInvocationList();
|
|
internal static Delegate[] EarlyUpdateDelegates => EarlyUpdate?.GetInvocationList();
|
|
internal static Delegate[] LastUpdateDelegates => LastUpdate?.GetInvocationList();
|
|
internal static Delegate[] FixedUpdateDelegates => FixedUpdate?.GetInvocationList();
|
|
|
|
internal static int UpdateLength => UpdateDelegates?.Length ?? 0;
|
|
internal static int LateUpdateLength => LateUpdateDelegates?.Length ?? 0;
|
|
internal static int EarlyUpdateLength => EarlyUpdateDelegates?.Length ?? 0;
|
|
internal static int LastUpdateLength => LastUpdateDelegates?.Length ?? 0;
|
|
internal static int FixedUpdateLength => FixedUpdateDelegates?.Length ?? 0;
|
|
}
|
|
} |