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, IEnumerable<IGameObject>
|
|
{
|
|
/// <summary>
|
|
/// Event triggered when <see cref="Update(EngineTime)"/> is called on the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnUpdateDelegate? OnUpdate;
|
|
|
|
/// <summary>
|
|
/// Event triggered when <see cref="PreDraw"/> is called on the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnPreDawDelegate? OnPreDraw;
|
|
|
|
/// <summary>
|
|
/// Event triggered when a <see cref="IGameObject"/> is registered to the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnGameObjectRegisteredDelegate? OnGameObjectRegistered;
|
|
|
|
/// <summary>
|
|
/// Event triggered when a <see cref="IGameObject"/> is unregistered from the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnGameObjectUnRegisteredDelegate? OnGameObjectUnRegistered;
|
|
|
|
/// <summary>
|
|
/// Event triggered when a <see cref="IHierarchyObject"/> is registered to the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnHierarchyObjectRegisteredDelegate? OnHierarchyObjectRegistered;
|
|
|
|
/// <summary>
|
|
/// Event triggered when a <see cref="IHierarchyObject"/> is unregistered from the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
event OnHierarchyObjectUnRegisteredDelegate? 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 OnUpdateDelegate(IGameManager sender, EngineTime time);
|
|
delegate void OnPreDawDelegate(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);
|
|
}
|