20 lines
503 B
C#
20 lines
503 B
C#
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) { }
|
|
}
|