feat: IBehaviourController.GetBehaviours(List)

This commit is contained in:
2024-01-30 12:31:51 +03:00
parent 1438b19e35
commit 514e5b5762
2 changed files with 16 additions and 0 deletions

View File

@@ -70,6 +70,18 @@ public class BehaviourController : IBehaviourController
return behaviours ?? Enumerable.Empty<T>().ToList();
}
public void GetBehaviours<T>(List<T> behaviors)
{
behaviors.Clear();
foreach (var behaviourItem in behaviours)
{
if (behaviourItem is not T _)
continue;
behaviours.Add(behaviourItem);
}
}
public void RemoveBehaviour<T>(bool removeAll = false) where T : class, IBehaviour
{
for (int i = behaviours.Count; i >= 0; i--)