using System; 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 : IAssignableGameObject, IEnumerable { /// /// Event triggered before the update of s. /// Action? OnPreUpdate { get; set; } /// /// Event triggered during the update of s. /// Action? OnUpdate { get; set; } /// /// Event triggered before the drawing phase. /// Action? OnPreDraw { get; set; } /// /// Event triggered when a is added to the . /// Action? OnBehaviourAdded { get; set; } /// /// Event triggered when a is removed from the . /// Action? OnBehaviourRemoved { get; set; } /// /// 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(List behaviours); /// /// 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(); }