60 lines
2.5 KiB
C#
60 lines
2.5 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>
|
|
/// Gets a read-only list of <see cref="IGameObject"/>s managed by the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
IReadOnlyList<IGameObject> GameObjects { 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);
|
|
}
|