77 lines
3.4 KiB
C#
77 lines
3.4 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 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 a <see cref="IGameObject"/> to the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
/// <param name="gameObject">The <see cref="IGameObject"/> to register.</param>
|
|
void RegisterGameObject(IGameObject gameObject);
|
|
|
|
/// <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 a <see cref="IGameObject"/> from the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
/// <param name="gameObject">The <see cref="IGameObject"/> to remove.</param>
|
|
/// <returns>The removed <see cref="IGameObject"/>.</returns>
|
|
IGameObject RemoveGameObject(IGameObject gameObject);
|
|
|
|
/// <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 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);
|
|
}
|