using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; namespace Syntriax.Engine.Core.Abstract; /// /// Responsible for controlling s and notify them accordingly about the engine's updates. Connected to an . /// public interface IBehaviourController : IAssignableGameObject { /// /// Callback triggered when the is called but right before the action is triggered. /// Action? OnPreUpdate { get; set; } /// /// Callback triggered when the is called. /// Action? OnUpdate { get; set; } /// /// Callback triggered when the is called. /// Action? OnPreDraw { get; set; } /// /// Callback triggered when the has been registered a new . /// Action? OnBehaviourAdded { get; set; } /// /// Callback triggered when the has been removed an existing . /// Action? OnBehaviourRemoved { get; set; } /// /// Registers the provided to be controlled by the . /// /// Uninitialized to be registered. /// An implemented class of /// The provided class after initialization. T AddBehaviour(T behaviour) where T : class, IBehaviour; /// /// Instantiates the provided type and registers it to the . /// /// Constructor parameters for the given class. /// An implemented class of /// The instantiated class after initialization. T AddBehaviour(params object?[]? args) where T : class, IBehaviour; /// /// Looks up and tries to get the that is controlled by the . /// /// If return value is outputs the class found in the . If the return value is falls, this parameter is /// An implemented class or /// /// , if the type of is present in the , if not. /// bool TryGetBehaviour([NotNullWhen(returnValue: true)] out T? behaviour); /// An implemented class or . /// Returns a list of all the matching s found in the . IList GetBehaviours(); /// An implemented class or . /// Fills the provided list parameter all the matching s found in the . void GetBehaviours(List behaviours); /// /// Removes the found in the . /// /// If all of the instances of the given Type is to be removed or not. /// An implemented class or of void RemoveBehaviour(bool removeAll = false) where T : class, IBehaviour; /// /// Removes the found in the . /// /// If all of the instances of the given Type is to be removed or not. /// An implemented class or of void RemoveBehaviour(T behaviour) where T : class, IBehaviour; /// /// To be called in every frame of the engine. Responsible for notifying 's under the 's control that a new frame is happening. /// /// information from the game. void Update(); /// /// To be called before every draw call from the engine. Responsible for notifying 's under the 's control that the engine is about to start drawing into the screen. /// /// information from the game. void UpdatePreDraw(); }