feat: added behaviour collector for active behaviours only
This commit is contained in:
19
Engine.Core/ActiveBehaviourCollectorSorted.cs
Normal file
19
Engine.Core/ActiveBehaviourCollectorSorted.cs
Normal 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) { }
|
||||
}
|
Reference in New Issue
Block a user