refactor: behaviour collector Count and indexer accessors added

This commit is contained in:
2025-05-29 23:16:10 +03:00
parent 67d7f401b8
commit b0f8b0dad6
6 changed files with 44 additions and 34 deletions

View File

@@ -1,4 +1,3 @@
using System;
using System.Collections;
using System.Collections.Generic;
@@ -16,7 +15,6 @@ public class ActiveBehaviourCollector<T> : IBehaviourCollector<T> where T : clas
protected readonly List<T> activeBehaviours = new(32);
protected readonly Dictionary<IActive, T> monitoringActiveToBehaviour = new(32);
public IReadOnlyList<T> Behaviours => activeBehaviours;
public IUniverse Universe { get; private set; } = null!;
public ActiveBehaviourCollector() { }
@@ -117,4 +115,7 @@ public class ActiveBehaviourCollector<T> : IBehaviourCollector<T> where T : clas
OnUnassigned?.Invoke(this);
return true;
}
public int Count => activeBehaviours.Count;
public T this[System.Index index] => activeBehaviours[index];
}