docs(core): Abstract
This commit is contained in:
@@ -5,102 +5,101 @@ using System.Diagnostics.CodeAnalysis;
|
||||
namespace Syntriax.Engine.Core.Abstract;
|
||||
|
||||
/// <summary>
|
||||
/// Responsible for controlling <see cref="IBehaviour"/>s and notify them accordingly about the engine's updates. Connected to an <see cref="IGameObject"/>.
|
||||
/// Represents a controller for managing <see cref="IBehaviour"/>s and notify them accordingly about the engine's updates. Connected to an <see cref="IGameObject"/>.
|
||||
/// </summary>
|
||||
public interface IBehaviourController : IAssignableGameObject, IEnumerable<IBehaviour>
|
||||
{
|
||||
/// <summary>
|
||||
/// Callback triggered when the <see cref="Update()"/> is called but right before the <see cref="OnUpdate"/> action is triggered.
|
||||
/// Event triggered before the update of <see cref="IBehaviour"/>s.
|
||||
/// </summary>
|
||||
Action<IBehaviourController>? OnPreUpdate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Callback triggered when the <see cref="Update()"/> is called.
|
||||
/// Event triggered during the update of <see cref="IBehaviour"/>s.
|
||||
/// </summary>
|
||||
Action<IBehaviourController>? OnUpdate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Callback triggered when the <see cref="OnPreDraw()"/> is called.
|
||||
/// Event triggered before the drawing phase.
|
||||
/// </summary>
|
||||
Action<IBehaviourController>? OnPreDraw { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Callback triggered when the <see cref="IBehaviourController"/> has been registered a new <see cref="IBehaviour"/>.
|
||||
/// Event triggered when a <see cref="IBehaviour"/> is added to the <see cref="IBehaviourController"/>.
|
||||
/// </summary>
|
||||
Action<IBehaviourController, IBehaviour>? OnBehaviourAdded { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Callback triggered when the <see cref="IBehaviourController"/> has been removed an existing <see cref="IBehaviour"/>.
|
||||
/// Event triggered when a <see cref="IBehaviour"/> is removed from the <see cref="IBehaviourController"/>.
|
||||
/// </summary>
|
||||
Action<IBehaviourController, IBehaviour>? OnBehaviourRemoved { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Registers the provided <see cref="IBehaviour"/> to be controlled by the <see cref="IBehaviourController"/>.
|
||||
/// Adds a <see cref="IBehaviour"/> to the <see cref="IBehaviourController"/>.
|
||||
/// </summary>
|
||||
/// <param name="behaviour">Uninitialized <see cref="IBehaviour"/> to be registered.</param>
|
||||
/// <typeparam name="T">An implemented class of <see cref="IBehaviour"/></typeparam>
|
||||
/// <returns>The provided <see cref="IBehaviour"/> class after initialization.</returns>
|
||||
/// <typeparam name="T">The type of <see cref="IBehaviour"/> to add.</typeparam>
|
||||
/// <param name="behaviour">The <see cref="IBehaviour"/> to add.</param>
|
||||
/// <returns>The added <see cref="IBehaviour"/>.</returns>
|
||||
T AddBehaviour<T>(T behaviour) where T : class, IBehaviour;
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates the provided <see cref="IBehaviour"/> type and registers it to the <see cref="IBehaviourController"/>.
|
||||
/// Adds a <see cref="IBehaviour"/> of the specified type to the <see cref="IBehaviourController"/>.
|
||||
/// </summary>
|
||||
/// <param name="args">Constructor parameters for the given <see cref="IBehaviour"/> class.</param>
|
||||
/// <typeparam name="T">An implemented class of <see cref="IBehaviour"/></typeparam>
|
||||
/// <returns>The instantiated <see cref="IBehaviour"/> class after initialization.</returns>
|
||||
/// <typeparam name="T">The type of <see cref="IBehaviour"/> to add.</typeparam>
|
||||
/// <param name="args">Construction parameters for the <see cref="IBehaviour"/>.</param>
|
||||
/// <returns>The added <see cref="IBehaviour"/>.</returns>
|
||||
T AddBehaviour<T>(params object?[]? args) where T : class, IBehaviour;
|
||||
|
||||
/// <summary>
|
||||
/// Looks up and returns the <see cref="IBehaviour"/> that is controlled by the <see cref="IBehaviourController"/>.
|
||||
/// Gets a <see cref="IBehaviour"/> of the specified type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">An implemented class or <see cref="interface"/></typeparam>
|
||||
/// <returns>
|
||||
/// <see cref="T"/>, if the type of <see cref="IBehaviour"/> is present in the <see cref="IBehaviourController"/>, <see cref="null"/> if not.
|
||||
/// </returns>
|
||||
/// <typeparam name="T">The type of <see cref="IBehaviour"/> to get.</typeparam>
|
||||
/// <returns>The <see cref="IBehaviour"/> of the specified type if found; otherwise, <see cref="null"/>.</returns>
|
||||
T? GetBehaviour<T>();
|
||||
|
||||
/// <summary>
|
||||
/// Looks up and tries to get the <see cref="IBehaviour"/> that is controlled by the <see cref="IBehaviourController"/>.
|
||||
/// Tries to get a <see cref="IBehaviour"/> of the specified type.
|
||||
/// </summary>
|
||||
/// <param name="behaviour">If return value is <see cref="true"/> outputs the class found in the <see cref="IBehaviourController"/>. If the return value is falls, this parameter is <see cref="null"/></param>
|
||||
/// <typeparam name="T">An implemented class or <see cref="interface"/></typeparam>
|
||||
/// <returns>
|
||||
/// <see cref="true"/>, if the type of <see cref="IBehaviour"/> is present in the <see cref="IBehaviourController"/>, <see cref="false"/> if not.
|
||||
/// </returns>
|
||||
/// <typeparam name="T">The type of <see cref="IBehaviour"/> to get.</typeparam>
|
||||
/// <param name="behaviour">When this method returns, contains the <see cref="IBehaviour"/> of the specified type, if found; otherwise, see.</param>
|
||||
/// <returns><see cref="true"/> if a <see cref="IBehaviour"/> of the specified type was found; otherwise, <see cref="false"/>.</returns>
|
||||
bool TryGetBehaviour<T>([NotNullWhen(returnValue: true)] out T? behaviour);
|
||||
|
||||
/// <typeparam name="T">An implemented class or <see cref="interface"/>.</typeparam>
|
||||
/// <returns>Returns a list of all the matching <see cref="IBehaviour"/>s found in the <see cref="IBehaviourController"/>.</returns>
|
||||
/// <summary>
|
||||
/// Gets all <see cref="IBehaviour"/>s of the specified type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of <see cref="IBehaviour"/>s to get.</typeparam>
|
||||
/// <returns>A list of <see cref="IBehaviour"/>s of the specified type.</returns>
|
||||
IList<T> GetBehaviours<T>();
|
||||
|
||||
/// <typeparam name="T">An implemented class or <see cref="interface"/>.</typeparam>
|
||||
/// <returns>Fills the provided list parameter all the matching <see cref="IBehaviour"/>s found in the <see cref="IBehaviourController"/>.</returns>
|
||||
/// <summary>
|
||||
/// Gets all <see cref="IBehaviour"/>s of the specified type and stores them in the provided list.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of <see cref="IBehaviour"/>s to get.</typeparam>
|
||||
/// <param name="behaviours">The list to store the <see cref="IBehaviour"/>s.</param>
|
||||
void GetBehaviours<T>(List<T> behaviours);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the <see cref="IBehaviour"/> found in the <see cref="IBehaviourController"/>.
|
||||
/// Removes <see cref="IBehaviour"/>s of the specified type from the <see cref="IBehaviourController"/>.
|
||||
/// </summary>
|
||||
/// <param name="removeAll">If all of the instances of the given Type is to be removed or not.</param>
|
||||
/// <typeparam name="T">An implemented class or <see cref="interface"/> of <see cref="IBehaviour"/></typeparam>
|
||||
/// <typeparam name="T">The type of <see cref="IBehaviour"/>s to remove.</typeparam>
|
||||
/// <param name="removeAll">A flag indicating whether to remove all <see cref="IBehaviour"/>s of the specified type.</param>
|
||||
void RemoveBehaviour<T>(bool removeAll = false) where T : class, IBehaviour;
|
||||
|
||||
/// <summary>
|
||||
/// Removes the <see cref="IBehaviour"/> found in the <see cref="IBehaviourController"/>.
|
||||
/// Removes the specified <see cref="IBehaviour"/> from the <see cref="IBehaviourController"/>.
|
||||
/// </summary>
|
||||
/// <param name="removeAll">If all of the instances of the given Type is to be removed or not.</param>
|
||||
/// <typeparam name="T">An implemented class or <see cref="interface"/> of <see cref="IBehaviour"/></typeparam>
|
||||
/// <typeparam name="T">The type of <see cref="IBehaviour"/> to remove.</typeparam>
|
||||
/// <param name="behaviour">The <see cref="IBehaviour"/> to remove.</param>
|
||||
void RemoveBehaviour<T>(T behaviour) where T : class, IBehaviour;
|
||||
|
||||
/// <summary>
|
||||
/// To be called in every frame of the engine. Responsible for notifying <see cref="IBehaviour"/>'s under the <see cref="IBehaviourController"/>'s control that a new frame is happening.
|
||||
/// Updates all <see cref="IBehaviour"/>s in the <see cref="IBehaviourController"/>.
|
||||
/// </summary>
|
||||
/// <param name=""><see cref=""/> information from the game.</param>
|
||||
void Update();
|
||||
|
||||
/// <summary>
|
||||
/// To be called before every draw call from the engine. Responsible for notifying <see cref="IBehaviour"/>'s under the <see cref="IBehaviourController"/>'s control that the engine is about to start drawing into the screen.
|
||||
/// Performs pre-draw operations.
|
||||
/// </summary>
|
||||
/// <param name=""><see cref=""/> information from the game.</param>
|
||||
void UpdatePreDraw();
|
||||
}
|
||||
|
Reference in New Issue
Block a user