refactor: IBehaviourController & Sorted Collector

This commit is contained in:
2024-11-24 22:14:42 +03:00
parent eb5345dc77
commit 58a9ada345
3 changed files with 62 additions and 8 deletions

View File

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