refactor: got rid of the static Time class and implemented EngineTime on IGameManager

This commit is contained in:
2025-03-30 20:19:03 +03:00
parent 82705ba378
commit b73c9ed0ae
5 changed files with 21 additions and 31 deletions

View File

@@ -8,7 +8,7 @@ namespace Syntriax.Engine.Core.Abstract;
public interface IGameManager : IEntity
{
/// <summary>
/// Event triggered when <see cref="Update(EngineTime)"/> is called on the <see cref="IGameManager"/>.
/// Event triggered when <see cref="Update(double)"/> is called on the <see cref="IGameManager"/>.
/// </summary>
event UpdateEventHandler? OnUpdate;
@@ -27,6 +27,11 @@ public interface IGameManager : IEntity
/// </summary>
event HierarchyObjectUnRegisteredEventHandler? OnHierarchyObjectUnRegistered;
/// <summary>
/// Contains time data related to this <see cref="IGameManager"/>.
/// </summary>
EngineTime Time { get; }
/// <summary>
/// Gets a read-only list of <see cref="IHierarchyObject"/>s managed by the <see cref="IGameManager"/>.
/// </summary>
@@ -53,17 +58,17 @@ public interface IGameManager : IEntity
void Remove(IHierarchyObject hierarchyObject);
/// <summary>
/// Updates the <see cref="IGameManager"/> with the given engine time data.
/// Updates the <see cref="IGameManager"/> with the given delta time.
/// </summary>
/// <param name="time">The engine time.</param>
void Update(EngineTime time);
/// <param name="engineTime">Delta time.</param>
void Update(EngineTime engineTime);
/// <summary>
/// Performs operations that should be done before the draw calls.
/// </summary>
void PreDraw();
delegate void UpdateEventHandler(IGameManager sender, EngineTime time);
delegate void UpdateEventHandler(IGameManager sender, EngineTime engineTime);
delegate void PreDawEventHandler(IGameManager sender);
delegate void HierarchyObjectRegisteredEventHandler(IGameManager sender, IHierarchyObject hierarchyObjectRegistered);