89 lines
3.8 KiB
C#
89 lines
3.8 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Syntriax.Engine.Core.Abstract;
|
|
|
|
/// <summary>
|
|
/// Represents a game world responsible for managing <see cref="IGameObject"/>s.
|
|
/// </summary>
|
|
public interface IGameManager : IEntity
|
|
{
|
|
/// <summary>
|
|
/// Event triggered when <see cref="Update(EngineTime)"/> is called on the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnUpdateEventHandler? OnUpdate;
|
|
|
|
/// <summary>
|
|
/// Event triggered when <see cref="PreDraw"/> is called on the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnPreDawEventHandler? OnPreDraw;
|
|
|
|
/// <summary>
|
|
/// Event triggered when a <see cref="IGameObject"/> is registered to the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnGameObjectRegisteredEventHandler? OnGameObjectRegistered;
|
|
|
|
/// <summary>
|
|
/// Event triggered when a <see cref="IGameObject"/> is unregistered from the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnGameObjectUnRegisteredEventHandler? OnGameObjectUnRegistered;
|
|
|
|
/// <summary>
|
|
/// Event triggered when a <see cref="IHierarchyObject"/> is registered to the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnHierarchyObjectRegisteredEventHandler? OnHierarchyObjectRegistered;
|
|
|
|
/// <summary>
|
|
/// Event triggered when a <see cref="IHierarchyObject"/> is unregistered from the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnHierarchyObjectUnRegisteredEventHandler? OnHierarchyObjectUnRegistered;
|
|
|
|
/// <summary>
|
|
/// Gets a read-only list of <see cref="IGameObject"/>s managed by the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
IReadOnlyList<IGameObject> GameObjects { get; }
|
|
|
|
/// <summary>
|
|
/// Gets a read-only list of <see cref="IHierarchyObject"/>s managed by the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
IReadOnlyList<IHierarchyObject> HierarchyObjects { get; }
|
|
|
|
/// <summary>
|
|
/// Registers an <see cref="IHierarchyObject"/> to the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
/// <param name="hierarchyObject">The <see cref="IHierarchyObject"/> to register.</param>
|
|
void Register(IHierarchyObject hierarchyObject);
|
|
|
|
/// <summary>
|
|
/// Instantiates a <see cref="IGameObject"/> of type T with the given arguments and registers it to the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
/// <typeparam name="T">The type of <see cref="IGameObject"/> to instantiate.</typeparam>
|
|
/// <param name="args">Constructor parameters for the given type of <see cref="IGameObject"/>.</param>
|
|
/// <returns>The instantiated <see cref="IGameObject"/>.</returns>
|
|
T InstantiateGameObject<T>(params object?[]? args) where T : class, IGameObject;
|
|
|
|
/// <summary>
|
|
/// Removes an <see cref="IHierarchyObject"/> from the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
/// <param name="hierarchyObject">The <see cref="IHierarchyObject"/> to remove.</param>
|
|
void Remove(IHierarchyObject hierarchyObject);
|
|
|
|
/// <summary>
|
|
/// Updates the <see cref="IGameManager"/> with the given engine time data.
|
|
/// </summary>
|
|
/// <param name="time">The engine time.</param>
|
|
void Update(EngineTime time);
|
|
|
|
/// <summary>
|
|
/// Performs operations that should be done before the draw calls.
|
|
/// </summary>
|
|
void PreDraw();
|
|
|
|
delegate void OnUpdateEventHandler(IGameManager sender, EngineTime time);
|
|
delegate void OnPreDawEventHandler(IGameManager sender);
|
|
|
|
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);
|
|
}
|