using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace Syntriax.Engine.Core.Abstract;
///
/// Represents a controller for managing s and notify them accordingly about the engine's updates. Connected to an .
///
public interface IBehaviourController : IInitialize, IAssignableGameObject, IEnumerable
{
///
/// Event triggered before the update of s.
///
event OnPreUpdateDelegate? OnPreUpdate;
///
/// Event triggered during the update of s.
///
event OnUpdateDelegate? OnUpdate;
///
/// Event triggered before the drawing phase.
///
event OnPreDrawDelegate? OnPreDraw;
///
/// Event triggered when a is added to the .
///
event OnBehaviourAddedDelegate? OnBehaviourAdded;
///
/// Event triggered when a is removed from the .
///
event OnBehaviourRemovedDelegate? OnBehaviourRemoved;
///
/// Adds a to the .
///
/// The type of to add.
/// The to add.
/// The added .
T AddBehaviour(T behaviour) where T : class, IBehaviour;
///
/// Adds a of the specified type to the .
///
/// The type of to add.
/// Construction parameters for the .
/// The added .
T AddBehaviour(params object?[]? args) where T : class, IBehaviour;
///
/// Gets a of the specified type.
///
/// The type of to get.
/// The of the specified type if found; otherwise, .
T? GetBehaviour();
///
/// Tries to get a of the specified type.
///
/// The type of to get.
/// When this method returns, contains the of the specified type, if found; otherwise, see.
/// if a of the specified type was found; otherwise, .
bool TryGetBehaviour([NotNullWhen(returnValue: true)] out T? behaviour);
///
/// Gets all s of the specified type.
///
/// The type of s to get.
/// A list of s of the specified type.
IList GetBehaviours();
///
/// Gets all s of the specified type and stores them in the provided list.
///
/// The type of s to get.
/// The list to store the s.
void GetBehaviours(IList results);
///
/// Removes s of the specified type from the .
///
/// The type of s to remove.
/// A flag indicating whether to remove all s of the specified type.
void RemoveBehaviour(bool removeAll = false) where T : class, IBehaviour;
///
/// Removes the specified from the .
///
/// The type of to remove.
/// The to remove.
void RemoveBehaviour(T behaviour) where T : class, IBehaviour;
///
/// Updates all s in the .
///
void Update();
///
/// Performs pre-draw operations.
///
void UpdatePreDraw();
delegate void OnPreUpdateDelegate(IBehaviourController sender);
delegate void OnUpdateDelegate(IBehaviourController sender);
delegate void OnPreDrawDelegate(IBehaviourController sender);
delegate void OnBehaviourAddedDelegate(IBehaviourController sender, IBehaviour behaviourAdded);
delegate void OnBehaviourRemovedDelegate(IBehaviourController sender, IBehaviour behaviourRemoved);
}