refactor: Renamed Delegate Declarations as EventHandler

This commit is contained in:
Syntriax 2024-11-23 23:14:44 +03:00
parent 981db0190f
commit e725a4e89c
33 changed files with 145 additions and 145 deletions

View File

@ -8,7 +8,7 @@ public interface IAssignable
/// <summary>
/// Event triggered when the <see cref="IAssignable"/>'s fields are unassigned and completely ready to recycle.
/// </summary>
event OnUnassignedDelegate? OnUnassigned;
event OnUnassignedEventHandler? OnUnassigned;
/// <summary>
/// Unassign <see cref="IAssignable"/>'s all fields and make it ready to recycle.
@ -18,5 +18,5 @@ public interface IAssignable
/// </returns>
bool Unassign();
delegate void OnUnassignedDelegate(IAssignable sender);
delegate void OnUnassignedEventHandler(IAssignable sender);
}

View File

@ -8,7 +8,7 @@ public interface IAssignableBehaviourController : IAssignable
/// <summary>
/// Event triggered when the <see cref="IBehaviourController"/> value has has been assigned a new value.
/// </summary>
event OnBehaviourControllerAssignedDelegate? OnBehaviourControllerAssigned;
event OnBehaviourControllerAssignedEventHandler? OnBehaviourControllerAssigned;
/// <inheritdoc cref="IBehaviourController" />
IBehaviourController BehaviourController { get; }
@ -22,5 +22,5 @@ public interface IAssignableBehaviourController : IAssignable
/// </returns>
bool Assign(IBehaviourController behaviourController);
delegate void OnBehaviourControllerAssignedDelegate(IAssignableBehaviourController sender);
delegate void OnBehaviourControllerAssignedEventHandler(IAssignableBehaviourController sender);
}

View File

@ -8,7 +8,7 @@ public interface IAssignableEntity : IAssignable
/// <summary>
/// Event triggered when the <see cref="IEntity"/> value has has been assigned a new value.
/// </summary>
event OnEntityAssignedDelegate? OnEntityAssigned;
event OnEntityAssignedEventHandler? OnEntityAssigned;
/// <inheritdoc cref="IEntity" />
IEntity Entity { get; }
@ -22,5 +22,5 @@ public interface IAssignableEntity : IAssignable
/// </returns>
bool Assign(IEntity entity);
delegate void OnEntityAssignedDelegate(IAssignableEntity sender);
delegate void OnEntityAssignedEventHandler(IAssignableEntity sender);
}

View File

@ -8,7 +8,7 @@ public interface IAssignableGameManager : IAssignable
/// <summary>
/// Event triggered when the <see cref="IGameManager"/> value has has been assigned a new value.
/// </summary>
event OnGameManagerAssignedDelegate? OnGameManagerAssigned;
event OnGameManagerAssignedEventHandler? OnGameManagerAssigned;
/// <inheritdoc cref="IGameManager" />
IGameManager GameManager { get; }
@ -22,5 +22,5 @@ public interface IAssignableGameManager : IAssignable
/// </returns>
bool Assign(IGameManager gameManager);
delegate void OnGameManagerAssignedDelegate(IAssignableGameManager sender);
delegate void OnGameManagerAssignedEventHandler(IAssignableGameManager sender);
}

View File

@ -8,7 +8,7 @@ public interface IAssignableGameObject : IAssignable
/// <summary>
/// Event triggered when the <see cref="IGameObject"/> value has has been assigned a new value.
/// </summary>
event OnGameObjectAssignedDelegate? OnGameObjectAssigned;
event OnGameObjectAssignedEventHandler? OnGameObjectAssigned;
/// <inheritdoc cref="IGameObject" />
IGameObject GameObject { get; }
@ -22,5 +22,5 @@ public interface IAssignableGameObject : IAssignable
/// </returns>
bool Assign(IGameObject gameObject);
delegate void OnGameObjectAssignedDelegate(IAssignableGameObject sender);
delegate void OnGameObjectAssignedEventHandler(IAssignableGameObject sender);
}

View File

@ -8,7 +8,7 @@ public interface IAssignableStateEnable : IAssignable
/// <summary>
/// Event triggered when the <see cref="IStateEnable"/> value has has been assigned a new value.
/// </summary>
event OnStateEnableAssignedDelegate? OnStateEnableAssigned;
event OnStateEnableAssignedEventHandler? OnStateEnableAssigned;
/// <inheritdoc cref="IStateEnable" />
IStateEnable StateEnable { get; }
@ -22,5 +22,5 @@ public interface IAssignableStateEnable : IAssignable
/// </returns>
bool Assign(IStateEnable stateEnable);
delegate void OnStateEnableAssignedDelegate(IAssignableStateEnable sender);
delegate void OnStateEnableAssignedEventHandler(IAssignableStateEnable sender);
}

View File

@ -8,7 +8,7 @@ public interface IAssignableTransform : IAssignable
/// <summary>
/// Event triggered when the <see cref="ITransform"/> value has has been assigned a new value.
/// </summary>
event OnTransformAssignedDelegate? OnTransformAssigned;
event OnTransformAssignedEventHandler? OnTransformAssigned;
/// <inheritdoc cref="ITransform" />
ITransform Transform { get; }
@ -22,5 +22,5 @@ public interface IAssignableTransform : IAssignable
/// </returns>
bool Assign(ITransform transform);
delegate void OnTransformAssignedDelegate(IAssignableTransform sender);
delegate void OnTransformAssignedEventHandler(IAssignableTransform sender);
}

View File

@ -10,12 +10,12 @@ public interface IHierarchyObject : IEntity, INameable
/// <summary>
/// Event triggered when the <see cref="IEntity"/> enters the hierarchy.
/// </summary>
event OnEnteredHierarchyDelegate? OnEnteredHierarchy;
event OnEnteredHierarchyEventHandler? OnEnteredHierarchy;
/// <summary>
/// Event triggered when the <see cref="IEntity"/> exits the hierarchy.
/// </summary>
event OnExitedHierarchyDelegate? OnExitedHierarchy;
event OnExitedHierarchyEventHandler? OnExitedHierarchy;
/// <summary>
/// Gets the <see cref="IGameManager"/> associated with this <see cref="IEntity"/> , if any.
@ -49,16 +49,16 @@ public interface IHierarchyObject : IEntity, INameable
internal bool ExitHierarchy();
/// <summary>
/// Delegate type for the event triggered when the <see cref="IEntity"/> enters the hierarchy of a <see cref="IGameManager">.
/// EventHandler delegate for the event triggered when the <see cref="IEntity"/> enters the hierarchy of a <see cref="IGameManager">.
/// </summary>
/// <param name="sender">The <see cref="IEntity"/> that entered the hierarchy.</param>
/// <param name="gameManager">The <see cref="IGameManager"/> that the <see cref="IEntity"/> has entered it's hierarchy.</param>
delegate void OnEnteredHierarchyDelegate(IHierarchyObject sender, IGameManager gameManager);
delegate void OnEnteredHierarchyEventHandler(IHierarchyObject sender, IGameManager gameManager);
/// <summary>
/// Delegate type for the event triggered when the <see cref="IEntity"/> exits the hierarchy of a <see cref="IGameManager">.
/// EventHandler delegate for the event triggered when the <see cref="IEntity"/> exits the hierarchy of a <see cref="IGameManager">.
/// </summary>
/// <param name="sender">The <see cref="IEntity"/> that exited the hierarchy.</param>
/// <param name="gameManager">The <see cref="IGameManager"/> that the <see cref="IEntity"/> has exited it's hierarchy.</param>
delegate void OnExitedHierarchyDelegate(IHierarchyObject sender, IGameManager gameManager);
delegate void OnExitedHierarchyEventHandler(IHierarchyObject sender, IGameManager gameManager);
}

View File

@ -6,13 +6,13 @@ namespace Syntriax.Engine.Core.Abstract;
public abstract class BaseEntity : IEntity
{
public event IEntity.OnIdChangedDelegate? OnIdChanged = null;
public event IEntity.OnIdChangedEventHandler? OnIdChanged = null;
public event IInitialize.OnInitializedDelegate? OnInitialized = null;
public event IInitialize.OnFinalizedDelegate? OnFinalized = null;
public event IInitialize.OnInitializedEventHandler? OnInitialized = null;
public event IInitialize.OnFinalizedEventHandler? OnFinalized = null;
public event IAssignableStateEnable.OnStateEnableAssignedDelegate? OnStateEnableAssigned = null;
public event IAssignable.OnUnassignedDelegate? OnUnassigned = null;
public event IAssignableStateEnable.OnStateEnableAssignedEventHandler? OnStateEnableAssigned = null;
public event IAssignable.OnUnassignedEventHandler? OnUnassigned = null;
private IStateEnable _stateEnable = null!;

View File

@ -8,7 +8,7 @@ public interface IBehaviour : IEntity, IAssignableBehaviourController, IAssignab
/// <summary>
/// Event triggered when the priority of the <see cref="IBehaviour"/> changes.
/// </summary>
event OnPriorityChangedDelegate? OnPriorityChanged;
event OnPriorityChangedEventHandler? OnPriorityChanged;
/// <summary>
/// The priority of the <see cref="IBehaviour"/>.
@ -20,5 +20,5 @@ public interface IBehaviour : IEntity, IAssignableBehaviourController, IAssignab
/// </summary>
bool IsActive { get; }
delegate void OnPriorityChangedDelegate(IBehaviour sender, int previousPriority);
delegate void OnPriorityChangedEventHandler(IBehaviour sender, int previousPriority);
}

View File

@ -11,27 +11,27 @@ public interface IBehaviourController : IInitialize, IAssignableGameObject, IEnu
/// <summary>
/// Event triggered before the update of <see cref="IBehaviour"/>s.
/// </summary>
event OnPreUpdateDelegate? OnPreUpdate;
event OnPreUpdateEventHandler? OnPreUpdate;
/// <summary>
/// Event triggered during the update of <see cref="IBehaviour"/>s.
/// </summary>
event OnUpdateDelegate? OnUpdate;
event OnUpdateEventHandler? OnUpdate;
/// <summary>
/// Event triggered before the drawing phase.
/// </summary>
event OnPreDrawDelegate? OnPreDraw;
event OnPreDrawEventHandler? OnPreDraw;
/// <summary>
/// Event triggered when a <see cref="IBehaviour"/> is added to the <see cref="IBehaviourController"/>.
/// </summary>
event OnBehaviourAddedDelegate? OnBehaviourAdded;
event OnBehaviourAddedEventHandler? OnBehaviourAdded;
/// <summary>
/// Event triggered when a <see cref="IBehaviour"/> is removed from the <see cref="IBehaviourController"/>.
/// </summary>
event OnBehaviourRemovedDelegate? OnBehaviourRemoved;
event OnBehaviourRemovedEventHandler? OnBehaviourRemoved;
/// <summary>
/// Adds a <see cref="IBehaviour"/> to the <see cref="IBehaviourController"/>.
@ -102,10 +102,10 @@ public interface IBehaviourController : IInitialize, IAssignableGameObject, IEnu
/// </summary>
void UpdatePreDraw();
delegate void OnPreUpdateDelegate(IBehaviourController sender);
delegate void OnUpdateDelegate(IBehaviourController sender);
delegate void OnPreDrawDelegate(IBehaviourController sender);
delegate void OnBehaviourAddedDelegate(IBehaviourController sender, IBehaviour behaviourAdded);
delegate void OnBehaviourRemovedDelegate(IBehaviourController sender, IBehaviour behaviourRemoved);
delegate void OnPreUpdateEventHandler(IBehaviourController sender);
delegate void OnUpdateEventHandler(IBehaviourController sender);
delegate void OnPreDrawEventHandler(IBehaviourController sender);
delegate void OnBehaviourAddedEventHandler(IBehaviourController sender, IBehaviour behaviourAdded);
delegate void OnBehaviourRemovedEventHandler(IBehaviourController sender, IBehaviour behaviourRemoved);
}

View File

@ -9,12 +9,12 @@ public interface IEntity : IInitialize, IAssignableStateEnable
/// Event triggered when the <see cref="Id"/> of the <see cref="IEntity"/> changes.
/// The string action parameter is the previous <see cref="Id"/> of the <see cref="IEntity"/>.
/// </summary>
event OnIdChangedDelegate? OnIdChanged;
event OnIdChangedEventHandler? OnIdChanged;
/// <summary>
/// The ID of the <see cref="IEntity"/>.
/// </summary>
string Id { get; set; }
delegate void OnIdChangedDelegate(IEntity sender, string previousId);
delegate void OnIdChangedEventHandler(IEntity sender, string previousId);
}

View File

@ -10,32 +10,32 @@ public interface IGameManager : IEntity
/// <summary>
/// Event triggered when <see cref="Update(EngineTime)"/> is called on the <see cref="IGameManager"/>.
/// </summary>
event OnUpdateDelegate? OnUpdate;
event OnUpdateEventHandler? OnUpdate;
/// <summary>
/// Event triggered when <see cref="PreDraw"/> is called on the <see cref="IGameManager"/>.
/// </summary>
event OnPreDawDelegate? OnPreDraw;
event OnPreDawEventHandler? OnPreDraw;
/// <summary>
/// Event triggered when a <see cref="IGameObject"/> is registered to the <see cref="IGameManager"/>.
/// </summary>
event OnGameObjectRegisteredDelegate? OnGameObjectRegistered;
event OnGameObjectRegisteredEventHandler? OnGameObjectRegistered;
/// <summary>
/// Event triggered when a <see cref="IGameObject"/> is unregistered from the <see cref="IGameManager"/>.
/// </summary>
event OnGameObjectUnRegisteredDelegate? OnGameObjectUnRegistered;
event OnGameObjectUnRegisteredEventHandler? OnGameObjectUnRegistered;
/// <summary>
/// Event triggered when a <see cref="IHierarchyObject"/> is registered to the <see cref="IGameManager"/>.
/// </summary>
event OnHierarchyObjectRegisteredDelegate? OnHierarchyObjectRegistered;
event OnHierarchyObjectRegisteredEventHandler? OnHierarchyObjectRegistered;
/// <summary>
/// Event triggered when a <see cref="IHierarchyObject"/> is unregistered from the <see cref="IGameManager"/>.
/// </summary>
event OnHierarchyObjectUnRegisteredDelegate? OnHierarchyObjectUnRegistered;
event OnHierarchyObjectUnRegisteredEventHandler? OnHierarchyObjectUnRegistered;
/// <summary>
/// Gets a read-only list of <see cref="IGameObject"/>s managed by the <see cref="IGameManager"/>.
@ -78,11 +78,11 @@ public interface IGameManager : IEntity
/// </summary>
void PreDraw();
delegate void OnUpdateDelegate(IGameManager sender, EngineTime time);
delegate void OnPreDawDelegate(IGameManager sender);
delegate void OnUpdateEventHandler(IGameManager sender, EngineTime time);
delegate void OnPreDawEventHandler(IGameManager sender);
delegate void OnGameObjectRegisteredDelegate(IGameManager sender, IGameObject gameObjectRegistered);
delegate void OnGameObjectUnRegisteredDelegate(IGameManager sender, IGameObject gameObjectUnregistered);
delegate void OnHierarchyObjectRegisteredDelegate(IGameManager sender, IHierarchyObject hierarchyObjectRegistered);
delegate void OnHierarchyObjectUnRegisteredDelegate(IGameManager sender, IHierarchyObject hierarchyObjectUnregistered);
delegate void OnGameObjectRegisteredEventHandler(IGameManager sender, IGameObject gameObjectRegistered);
delegate void OnGameObjectUnRegisteredEventHandler(IGameManager sender, IGameObject gameObjectUnregistered);
delegate void OnHierarchyObjectRegisteredEventHandler(IGameManager sender, IHierarchyObject hierarchyObjectRegistered);
delegate void OnHierarchyObjectUnRegisteredEventHandler(IGameManager sender, IHierarchyObject hierarchyObjectUnregistered);
}

View File

@ -8,12 +8,12 @@ public interface IGameObject : IEntity, IHierarchyObject, IAssignableTransform,
/// <summary>
/// Event triggered when the <see cref="Update"/> method is called.
/// </summary>
event OnUpdatedDelegate? OnUpdated;
event OnUpdatedEventHandler? OnUpdated;
/// <summary>
/// Updates the game object.
/// </summary>
void Update();
delegate void OnUpdatedDelegate(IGameObject sender);
delegate void OnUpdatedEventHandler(IGameObject sender);
}

View File

@ -8,12 +8,12 @@ public interface IInitialize
/// <summary>
/// Event triggered when the <see cref="Initialize"/> method is called successfully.
/// </summary>
event OnInitializedDelegate? OnInitialized;
event OnInitializedEventHandler? OnInitialized;
/// <summary>
/// Event triggered when the <see cref="Finalize"/> method is called successfully.
/// </summary>
event OnFinalizedDelegate? OnFinalized;
event OnFinalizedEventHandler? OnFinalized;
/// <summary>
/// The value indicating whether the entity has been initialized.
@ -32,6 +32,6 @@ public interface IInitialize
/// <returns><see cref="true"/> if finalization is successful, otherwise <see cref="false"/>.</returns>
bool Finalize();
delegate void OnInitializedDelegate(IInitialize sender);
delegate void OnFinalizedDelegate(IInitialize sender);
delegate void OnInitializedEventHandler(IInitialize sender);
delegate void OnFinalizedEventHandler(IInitialize sender);
}

View File

@ -8,12 +8,12 @@ public interface INameable
/// <summary>
/// Event triggered when the name of the entity changes.
/// </summary>
event OnNameChangedDelegate? OnNameChanged;
event OnNameChangedEventHandler? OnNameChanged;
/// <summary>
/// The name of the entity.
/// </summary>
string Name { get; set; }
delegate void OnNameChangedDelegate(INameable sender, string previousName);
delegate void OnNameChangedEventHandler(INameable sender, string previousName);
}

View File

@ -8,12 +8,12 @@ public interface IStateEnable : IAssignableEntity
/// <summary>
/// Event triggered when the <see cref="Enabled"/> state of the <see cref="IStateEnable"/> changes.
/// </summary>
event OnNameChangedDelegate? OnEnabledChanged;
event OnNameChangedEventHandler? OnEnabledChanged;
/// <summary>
/// The value indicating whether the <see cref="IStateEnable"/> is enabled.
/// </summary>
bool Enabled { get; set; }
delegate void OnNameChangedDelegate(IStateEnable sender, bool previousState);
delegate void OnNameChangedEventHandler(IStateEnable sender, bool previousState);
}

View File

@ -11,32 +11,32 @@ public interface ITransform : IAssignableGameObject, IEnumerable<ITransform>
/// <summary>
/// Event triggered when the <see cref="Position"/> of the <see cref="ITransform"/> changes.
/// </summary>
event OnPositionChangedDelegate? OnPositionChanged;
event OnPositionChangedEventHandler? OnPositionChanged;
/// <summary>
/// Event triggered when the <see cref="Scale"/> of the <see cref="ITransform"/> changes.
/// </summary>
event OnScaleChangedDelegate? OnScaleChanged;
event OnScaleChangedEventHandler? OnScaleChanged;
/// <summary>
/// Event triggered when the <see cref="Rotation"/> of the <see cref="ITransform"/> changes.
/// </summary>
event OnRotationChangedDelegate? OnRotationChanged;
event OnRotationChangedEventHandler? OnRotationChanged;
/// <summary>
/// Event triggered when the <see cref="Parent"/> of the <see cref="ITransform"/> changes. The second parameter is the old <see cref="ITransform"/>.
/// </summary>
event OnParentChangedDelegate? OnParentChanged;
event OnParentChangedEventHandler? OnParentChanged;
/// <summary>
/// Event triggered when a new <see cref="ITransform"/> is added to the <see cref="Children"/>.
/// </summary>
event OnChildrenAddedDelegate? OnChildrenAdded;
event OnChildrenAddedEventHandler? OnChildrenAdded;
/// <summary>
/// Event triggered when an <see cref="ITransform"/> is removed from the <see cref="Children"/>.
/// </summary>
event OnChildrenRemovedDelegate? OnChildrenRemoved;
event OnChildrenRemovedEventHandler? OnChildrenRemoved;
/// <summary>
/// The world position of the <see cref="ITransform"/> in 2D space.
@ -96,10 +96,10 @@ public interface ITransform : IAssignableGameObject, IEnumerable<ITransform>
/// <param name="transform">The child <see cref="ITransform"/> to remove.</param>
void RemoveChild(ITransform transform);
delegate void OnPositionChangedDelegate(ITransform sender);
delegate void OnScaleChangedDelegate(ITransform sender);
delegate void OnRotationChangedDelegate(ITransform sender);
delegate void OnParentChangedDelegate(ITransform sender, ITransform? previousParent, ITransform? newParent);
delegate void OnChildrenAddedDelegate(ITransform sender, ITransform childrenAdded);
delegate void OnChildrenRemovedDelegate(ITransform sender, ITransform childrenRemoved);
delegate void OnPositionChangedEventHandler(ITransform sender);
delegate void OnScaleChangedEventHandler(ITransform sender);
delegate void OnRotationChangedEventHandler(ITransform sender);
delegate void OnParentChangedEventHandler(ITransform sender, ITransform? previousParent, ITransform? newParent);
delegate void OnChildrenAddedEventHandler(ITransform sender, ITransform childrenAdded);
delegate void OnChildrenRemovedEventHandler(ITransform sender, ITransform childrenRemoved);
}

View File

@ -6,9 +6,9 @@ namespace Syntriax.Engine.Core;
[System.Diagnostics.DebuggerDisplay("{GetType().Name, nq}, Priority: {Priority}, Initialized: {Initialized}")]
public abstract class BehaviourBase : BaseEntity, IBehaviour
{
public event IAssignableBehaviourController.OnBehaviourControllerAssignedDelegate? OnBehaviourControllerAssigned = null;
public event IAssignableBehaviourController.OnBehaviourControllerAssignedEventHandler? OnBehaviourControllerAssigned = null;
public event IBehaviour.OnPriorityChangedDelegate? OnPriorityChanged = null;
public event IBehaviour.OnPriorityChangedEventHandler? OnPriorityChanged = null;
private IBehaviourController _behaviourController = null!;

View File

@ -8,11 +8,11 @@ namespace Syntriax.Engine.Core;
public class BehaviourCollector<T> : IAssignableGameManager, IEnumerable<T>
{
public event IAssignable.OnUnassignedDelegate? OnUnassigned = null;
public event IAssignableGameManager.OnGameManagerAssignedDelegate? OnGameManagerAssigned = null;
public event IAssignable.OnUnassignedEventHandler? OnUnassigned = null;
public event IAssignableGameManager.OnGameManagerAssignedEventHandler? OnGameManagerAssigned = null;
public event OnCollectedDelegate? OnCollected = null;
public event OnRemovedDelegate? OnRemoved = null;
public event OnCollectedEventHandler? OnCollected = null;
public event OnRemovedEventHandler? OnRemoved = null;
private readonly List<T> _behaviours = new(32);
@ -99,6 +99,6 @@ public class BehaviourCollector<T> : IAssignableGameManager, IEnumerable<T>
IEnumerator IEnumerable.GetEnumerator() => _behaviours.GetEnumerator();
public delegate void OnCollectedDelegate(BehaviourCollector<T> sender, T behaviourCollected);
public delegate void OnRemovedDelegate(BehaviourCollector<T> sender, T behaviourRemoved);
public delegate void OnCollectedEventHandler(BehaviourCollector<T> sender, T behaviourCollected);
public delegate void OnRemovedEventHandler(BehaviourCollector<T> sender, T behaviourRemoved);
}

View File

@ -12,18 +12,18 @@ namespace Syntriax.Engine.Core;
[System.Diagnostics.DebuggerDisplay("Behaviour Count: {behaviours.Count}")]
public class BehaviourController : IBehaviourController
{
public event IBehaviourController.OnPreUpdateDelegate? OnPreUpdate = null;
public event IBehaviourController.OnUpdateDelegate? OnUpdate = null;
public event IBehaviourController.OnPreDrawDelegate? OnPreDraw = null;
public event IBehaviourController.OnPreUpdateEventHandler? OnPreUpdate = null;
public event IBehaviourController.OnUpdateEventHandler? OnUpdate = null;
public event IBehaviourController.OnPreDrawEventHandler? OnPreDraw = null;
public event IBehaviourController.OnBehaviourAddedDelegate? OnBehaviourAdded = null;
public event IBehaviourController.OnBehaviourRemovedDelegate? OnBehaviourRemoved = null;
public event IAssignableGameObject.OnGameObjectAssignedDelegate? OnGameObjectAssigned = null;
public event IBehaviourController.OnBehaviourAddedEventHandler? OnBehaviourAdded = null;
public event IBehaviourController.OnBehaviourRemovedEventHandler? OnBehaviourRemoved = null;
public event IAssignableGameObject.OnGameObjectAssignedEventHandler? OnGameObjectAssigned = null;
public event IInitialize.OnInitializedDelegate? OnInitialized = null;
public event IInitialize.OnFinalizedDelegate? OnFinalized = null;
public event IInitialize.OnInitializedEventHandler? OnInitialized = null;
public event IInitialize.OnFinalizedEventHandler? OnFinalized = null;
public event IAssignable.OnUnassignedDelegate? OnUnassigned = null;
public event IAssignable.OnUnassignedEventHandler? OnUnassigned = null;
private readonly IList<IBehaviour> behaviours = new List<IBehaviour>(Constants.BEHAVIOURS_SIZE_INITIAL);

View File

@ -11,13 +11,13 @@ namespace Syntriax.Engine.Core;
[System.Diagnostics.DebuggerDisplay("GameObject Count: {_gameObjects.Count}")]
public class GameManager : BaseEntity, IGameManager
{
public event IGameManager.OnUpdateDelegate? OnUpdate = null;
public event IGameManager.OnPreDawDelegate? OnPreDraw = null;
public event IGameManager.OnUpdateEventHandler? OnUpdate = null;
public event IGameManager.OnPreDawEventHandler? OnPreDraw = null;
public event IGameManager.OnGameObjectRegisteredDelegate? OnGameObjectRegistered = null;
public event IGameManager.OnGameObjectUnRegisteredDelegate? OnGameObjectUnRegistered = null;
public event IGameManager.OnHierarchyObjectRegisteredDelegate? OnHierarchyObjectRegistered = null;
public event IGameManager.OnHierarchyObjectUnRegisteredDelegate? OnHierarchyObjectUnRegistered = null;
public event IGameManager.OnGameObjectRegisteredEventHandler? OnGameObjectRegistered = null;
public event IGameManager.OnGameObjectUnRegisteredEventHandler? OnGameObjectUnRegistered = null;
public event IGameManager.OnHierarchyObjectRegisteredEventHandler? OnHierarchyObjectRegistered = null;
public event IGameManager.OnHierarchyObjectUnRegisteredEventHandler? OnHierarchyObjectUnRegistered = null;
private readonly List<IGameObject> _gameObjects = new(Constants.GAME_OBJECTS_SIZE_INITIAL);
private readonly List<IHierarchyObject> _hierarchyObjects = new(Constants.GAME_OBJECTS_SIZE_INITIAL);

View File

@ -6,15 +6,15 @@ namespace Syntriax.Engine.Core;
[System.Diagnostics.DebuggerDisplay("Name: {Name}, Initialized: {Initialized}")]
public class GameObject : BaseEntity, IGameObject
{
public event IHierarchyObject.OnEnteredHierarchyDelegate? OnEnteredHierarchy = null;
public event IHierarchyObject.OnExitedHierarchyDelegate? OnExitedHierarchy = null;
public event IHierarchyObject.OnEnteredHierarchyEventHandler? OnEnteredHierarchy = null;
public event IHierarchyObject.OnExitedHierarchyEventHandler? OnExitedHierarchy = null;
public event IAssignableTransform.OnTransformAssignedDelegate? OnTransformAssigned = null;
public event IAssignableBehaviourController.OnBehaviourControllerAssignedDelegate? OnBehaviourControllerAssigned = null;
public event IAssignableTransform.OnTransformAssignedEventHandler? OnTransformAssigned = null;
public event IAssignableBehaviourController.OnBehaviourControllerAssignedEventHandler? OnBehaviourControllerAssigned = null;
public event INameable.OnNameChangedDelegate? OnNameChanged = null;
public event INameable.OnNameChangedEventHandler? OnNameChanged = null;
public event IGameObject.OnUpdatedDelegate? OnUpdated = null;
public event IGameObject.OnUpdatedEventHandler? OnUpdated = null;
private ITransform _transform = null!;
private IBehaviourController _behaviourController = null!;

View File

@ -4,14 +4,14 @@ namespace Syntriax.Engine.Core;
public abstract class HierarchyObjectBase : IHierarchyObject
{
public event IHierarchyObject.OnEnteredHierarchyDelegate? OnEnteredHierarchy = null;
public event IHierarchyObject.OnExitedHierarchyDelegate? OnExitedHierarchy = null;
public event IEntity.OnIdChangedDelegate? OnIdChanged = null;
public event IInitialize.OnInitializedDelegate? OnInitialized = null;
public event IInitialize.OnFinalizedDelegate? OnFinalized = null;
public event IAssignableStateEnable.OnStateEnableAssignedDelegate? OnStateEnableAssigned = null;
public event IAssignable.OnUnassignedDelegate? OnUnassigned = null;
public event INameable.OnNameChangedDelegate? OnNameChanged = null;
public event IHierarchyObject.OnEnteredHierarchyEventHandler? OnEnteredHierarchy = null;
public event IHierarchyObject.OnExitedHierarchyEventHandler? OnExitedHierarchy = null;
public event IEntity.OnIdChangedEventHandler? OnIdChanged = null;
public event IInitialize.OnInitializedEventHandler? OnInitialized = null;
public event IInitialize.OnFinalizedEventHandler? OnFinalized = null;
public event IAssignableStateEnable.OnStateEnableAssignedEventHandler? OnStateEnableAssigned = null;
public event IAssignable.OnUnassignedEventHandler? OnUnassigned = null;
public event INameable.OnNameChangedEventHandler? OnNameChanged = null;
private string _id = string.Empty;
private string _name = nameof(HierarchyObjectBase);

View File

@ -4,9 +4,9 @@ namespace Syntriax.Engine.Core;
public class StateEnable : IStateEnable
{
public event IAssignable.OnUnassignedDelegate? OnUnassigned = null;
public event IAssignableEntity.OnEntityAssignedDelegate? OnEntityAssigned = null;
public event IStateEnable.OnNameChangedDelegate? OnEnabledChanged = null;
public event IAssignable.OnUnassignedEventHandler? OnUnassigned = null;
public event IAssignableEntity.OnEntityAssignedEventHandler? OnEntityAssigned = null;
public event IStateEnable.OnNameChangedEventHandler? OnEnabledChanged = null;
private bool _enabled = true;
private IEntity _entity = null!;

View File

@ -8,17 +8,17 @@ namespace Syntriax.Engine.Core;
[System.Diagnostics.DebuggerDisplay("Name: {GameObject.Name, nq} Position: {Position.ToString(), nq}, Scale: {Scale.ToString(), nq}, Rotation: {Rotation}")]
public class Transform : ITransform
{
public event IAssignableGameObject.OnGameObjectAssignedDelegate? OnGameObjectAssigned = null;
public event IAssignableGameObject.OnGameObjectAssignedEventHandler? OnGameObjectAssigned = null;
public event IAssignable.OnUnassignedDelegate? OnUnassigned = null;
public event IAssignable.OnUnassignedEventHandler? OnUnassigned = null;
public event ITransform.OnPositionChangedDelegate? OnPositionChanged = null;
public event ITransform.OnScaleChangedDelegate? OnScaleChanged = null;
public event ITransform.OnRotationChangedDelegate? OnRotationChanged = null;
public event ITransform.OnPositionChangedEventHandler? OnPositionChanged = null;
public event ITransform.OnScaleChangedEventHandler? OnScaleChanged = null;
public event ITransform.OnRotationChangedEventHandler? OnRotationChanged = null;
public event ITransform.OnParentChangedDelegate? OnParentChanged = null;
public event ITransform.OnChildrenAddedDelegate? OnChildrenAdded = null;
public event ITransform.OnChildrenRemovedDelegate? OnChildrenRemoved = null;
public event ITransform.OnParentChangedEventHandler? OnParentChanged = null;
public event ITransform.OnChildrenAddedEventHandler? OnChildrenAdded = null;
public event ITransform.OnChildrenRemovedEventHandler? OnChildrenRemoved = null;
private Vector2D _position = Vector2D.Zero;

View File

@ -4,12 +4,12 @@ namespace Syntriax.Engine.Input;
public interface IButtonInputs<T> : IAssignableStateEnable
{
void RegisterOnPress(T button, ButtonCallbackDelegate callback);
void UnregisterOnPress(T button, ButtonCallbackDelegate callback);
void RegisterOnRelease(T button, ButtonCallbackDelegate callback);
void UnregisterOnRelease(T button, ButtonCallbackDelegate callback);
void RegisterOnPress(T button, ButtonCallbackEventHandler callback);
void UnregisterOnPress(T button, ButtonCallbackEventHandler callback);
void RegisterOnRelease(T button, ButtonCallbackEventHandler callback);
void UnregisterOnRelease(T button, ButtonCallbackEventHandler callback);
bool IsPressed(T button);
delegate void ButtonCallbackDelegate(IButtonInputs<T> buttonInputs, T button);
delegate void ButtonCallbackEventHandler(IButtonInputs<T> buttonInputs, T button);
}

View File

@ -10,17 +10,17 @@ public interface ICollider2D : IBehaviour, IAssignableTransform
/// <summary>
/// Event triggered when a collision is detected.
/// </summary>
event OnCollisionDetectedDelegate? OnCollisionDetected;
event OnCollisionDetectedEventHandler? OnCollisionDetected;
/// <summary>
/// Event triggered when a collision is resolved.
/// </summary>
event OnCollisionResolvedDelegate? OnCollisionResolved;
event OnCollisionResolvedEventHandler? OnCollisionResolved;
/// <summary>
/// Event triggered when another <see cref="ICollider2D"/> triggers this <see cref="ICollider2D"/>.
/// </summary>
event OnTriggeredDelegate? OnTriggered;
event OnTriggeredEventHandler? OnTriggered;
/// <summary>
/// The <see cref="IRigidBody2D"/> associated with the <see cref="ICollider2D"/>.
@ -41,7 +41,7 @@ public interface ICollider2D : IBehaviour, IAssignableTransform
void Resolve(CollisionDetectionInformation collisionDetectionInformation);
void Trigger(ICollider2D initiator);
delegate void OnCollisionDetectedDelegate(ICollider2D sender, CollisionDetectionInformation collisionDetectionInformation);
delegate void OnCollisionResolvedDelegate(ICollider2D sender, CollisionDetectionInformation collisionDetectionInformation);
delegate void OnTriggeredDelegate(ICollider2D sender, ICollider2D initiatorCollider);
delegate void OnCollisionDetectedEventHandler(ICollider2D sender, CollisionDetectionInformation collisionDetectionInformation);
delegate void OnCollisionResolvedEventHandler(ICollider2D sender, CollisionDetectionInformation collisionDetectionInformation);
delegate void OnTriggeredEventHandler(ICollider2D sender, ICollider2D initiatorCollider);
}

View File

@ -8,12 +8,12 @@ public interface IPhysicsEngine2D
/// <summary>
/// Event triggered when the <see cref="IPhysicsEngine2D"/> has done a single physics iteration.
/// </summary>
event OnPhysicsIterationDelegate? OnPhysicsIteration;
event OnPhysicsIterationEventHandler? OnPhysicsIteration;
/// <summary>
/// Event triggered when the <see cref="IPhysicsEngine2D"/> has done a full physics step/>.
/// </summary>
event OnPhysicsStepDelegate? OnPhysicsStep;
event OnPhysicsStepEventHandler? OnPhysicsStep;
/// <summary>
/// The number of iterations the <see cref="IPhysicsEngine2D"/> performs per step.
@ -26,6 +26,6 @@ public interface IPhysicsEngine2D
/// <param name="deltaTime">The time step.</param>
void Step(float deltaTime);
delegate void OnPhysicsIterationDelegate(IPhysicsEngine2D sender, float iterationDeltaTime);
delegate void OnPhysicsStepDelegate(IPhysicsEngine2D sender, float stepDeltaTime);
delegate void OnPhysicsIterationEventHandler(IPhysicsEngine2D sender, float iterationDeltaTime);
delegate void OnPhysicsStepEventHandler(IPhysicsEngine2D sender, float stepDeltaTime);
}

View File

@ -6,9 +6,9 @@ namespace Syntriax.Engine.Physics2D;
public abstract class Collider2DBehaviourBase : Behaviour, ICollider2D
{
public event ICollider2D.OnCollisionDetectedDelegate? OnCollisionDetected = null;
public event ICollider2D.OnCollisionResolvedDelegate? OnCollisionResolved = null;
public event ICollider2D.OnTriggeredDelegate? OnTriggered = null;
public event ICollider2D.OnCollisionDetectedEventHandler? OnCollisionDetected = null;
public event ICollider2D.OnCollisionResolvedEventHandler? OnCollisionResolved = null;
public event ICollider2D.OnTriggeredEventHandler? OnTriggered = null;
protected bool NeedsRecalculation { get; private set; } = true;
@ -18,7 +18,7 @@ public abstract class Collider2DBehaviourBase : Behaviour, ICollider2D
public bool IsTrigger { get; set; } = false;
ITransform IAssignableTransform.Transform => Transform;
public event IAssignableTransform.OnTransformAssignedDelegate? OnTransformAssigned { add => GameObject.OnTransformAssigned += value; remove => GameObject.OnTransformAssigned -= value; }
public event IAssignableTransform.OnTransformAssignedEventHandler? OnTransformAssigned { add => GameObject.OnTransformAssigned += value; remove => GameObject.OnTransformAssigned -= value; }
bool IAssignableTransform.Assign(ITransform transform) => GameObject.Assign(transform);

View File

@ -7,8 +7,8 @@ namespace Syntriax.Engine.Physics2D;
public class PhysicsEngine2D : IPhysicsEngine2D
{
public event IPhysicsEngine2D.OnPhysicsIterationDelegate? OnPhysicsIteration = null;
public event IPhysicsEngine2D.OnPhysicsStepDelegate? OnPhysicsStep = null;
public event IPhysicsEngine2D.OnPhysicsIterationEventHandler? OnPhysicsIteration = null;
public event IPhysicsEngine2D.OnPhysicsStepEventHandler? OnPhysicsStep = null;
private readonly List<IRigidBody2D> rigidBodies = new(32);
private readonly List<ICollider2D> colliders = new(64);

View File

@ -6,8 +6,8 @@ namespace Syntriax.Engine.Physics2D;
public class PhysicsEngine2DCollector : HierarchyObjectBase, IPhysicsEngine2D
{
public event IPhysicsEngine2D.OnPhysicsIterationDelegate? OnPhysicsIteration = null;
public event IPhysicsEngine2D.OnPhysicsStepDelegate? OnPhysicsStep = null;
public event IPhysicsEngine2D.OnPhysicsIterationEventHandler? OnPhysicsIteration = null;
public event IPhysicsEngine2D.OnPhysicsStepEventHandler? OnPhysicsStep = null;
private int _iterationPerStep = 1;

View File

@ -6,7 +6,7 @@ namespace Syntriax.Engine.Physics2D;
public class RigidBody2D : Behaviour, IRigidBody2D
{
event IAssignableTransform.OnTransformAssignedDelegate? IAssignableTransform.OnTransformAssigned { add => GameObject.OnTransformAssigned += value; remove => GameObject.OnTransformAssigned -= value; }
event IAssignableTransform.OnTransformAssignedEventHandler? IAssignableTransform.OnTransformAssigned { add => GameObject.OnTransformAssigned += value; remove => GameObject.OnTransformAssigned -= value; }
private const float LOWEST_ALLOWED_MASS = 0.00001f;
private float _mass = 1f;