feat: IBehaviourController.CollectionMethod added

This commit is contained in:
2025-11-01 23:27:40 +03:00
parent 0bd2b0618d
commit 5f019892f1
3 changed files with 22 additions and 21 deletions

View File

@@ -62,7 +62,8 @@ public interface IBehaviourController : IEntity, IHasUniverseObject
/// </summary>
/// <typeparam name="T">The type of <see cref="IBehaviour"/>s to get.</typeparam>
/// <param name="results">The list to store the <see cref="IBehaviour"/>s.</param>
void GetBehaviours<T>(IList<T> results);
/// <param name="collectionMethod">Whether to clear the <paramref name="results"/> before collection or append the results to the list.</param>
void GetBehaviours<T>(IList<T> results, CollectionMethod collectionMethod = CollectionMethod.Clear);
/// <summary>
/// Removes <see cref="IBehaviour"/>s of the specified type from the <see cref="IBehaviourController"/>.
@@ -78,6 +79,8 @@ public interface IBehaviourController : IEntity, IHasUniverseObject
/// <param name="behaviour">The <see cref="IBehaviour"/> to remove.</param>
void RemoveBehaviour<T>(T behaviour) where T : class, IBehaviour;
enum CollectionMethod { Clear, Append };
readonly record struct BehaviourAddedArguments(IBehaviour BehaviourAdded);
readonly record struct BehaviourRemovedArguments(IBehaviour BehaviourRemoved);
}