58 lines
2.3 KiB
C#
58 lines
2.3 KiB
C#
using System;
|
|
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>
|
|
Action<IGameManager, IGameObject>? OnGameObjectRegistered { get; set; }
|
|
|
|
/// <summary>
|
|
/// Event triggered when a <see cref="IGameObject"/> is unregistered from the <see cref="IGameManager"/>.
|
|
/// </summary>
|
|
Action<IGameManager, IGameObject>? OnGameObjectUnRegistered { get; set; }
|
|
|
|
/// <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();
|
|
}
|