perf!: events refactored throughout all the project to use Event<> class
All delegate events are refactored to use the Event<TSender> and Event<TSender, TArgument> for performance issues regarding delegate events creating garbage, also this gives us better control on event invocation since C# Delegates did also create unnecessary garbage during Delegate.DynamicInvoke
This commit is contained in:
@@ -8,12 +8,12 @@ public interface IBehaviour : IEntity, IActive, IHasBehaviourController, IHasSta
|
||||
/// <summary>
|
||||
/// Event triggered when the priority of the <see cref="IBehaviour"/> changes.
|
||||
/// </summary>
|
||||
event PriorityChangedEventHandler? OnPriorityChanged;
|
||||
Event<IBehaviour, PriorityChangedArguments> OnPriorityChanged { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The priority of the <see cref="IBehaviour"/>.
|
||||
/// </summary>
|
||||
int Priority { get; set; }
|
||||
|
||||
delegate void PriorityChangedEventHandler(IBehaviour sender, int previousPriority);
|
||||
readonly record struct PriorityChangedArguments(int PreviousPriority);
|
||||
}
|
||||
|
Reference in New Issue
Block a user