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
20 lines
614 B
C#
20 lines
614 B
C#
namespace Syntriax.Engine.Core;
|
|
|
|
/// <summary>
|
|
/// Represents an entity with an enable state that can be toggled.
|
|
/// </summary>
|
|
public interface IStateEnable : IHasEntity
|
|
{
|
|
/// <summary>
|
|
/// Event triggered when the <see cref="Enabled"/> state of the <see cref="IStateEnable"/> changes.
|
|
/// </summary>
|
|
Event<IStateEnable, EnabledChangedArguments> OnEnabledChanged { get; }
|
|
|
|
/// <summary>
|
|
/// The value indicating whether the <see cref="IStateEnable"/> is enabled.
|
|
/// </summary>
|
|
bool Enabled { get; set; }
|
|
|
|
readonly record struct EnabledChangedArguments(bool PreviousState);
|
|
}
|