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