feat: added behaviour collector for active behaviours only

This commit is contained in:
2025-04-01 12:19:58 +03:00
parent 21600b856f
commit d4c6288b38
2 changed files with 142 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
using System;
using Syntriax.Engine.Core.Abstract;
namespace Syntriax.Engine.Core;
public class ActiveBehaviourCollectorSorted<T> : ActiveBehaviourCollector<T> where T : class, IBehaviour
{
public Comparison<T>? SortBy { get; set; } = null;
protected override void OnBehaviourAdd(IBehaviour behaviour)
{
if (SortBy is not null)
activeBehaviours.Sort(SortBy);
}
public ActiveBehaviourCollectorSorted() { }
public ActiveBehaviourCollectorSorted(IGameManager gameManager) : base(gameManager) { }
}