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;
@@ -14,7 +13,6 @@ public class BehaviourCollector<T> : IBehaviourCollector<T> where T : class
protected readonly List<T> behaviours = new(32);
public IReadOnlyList<T> Behaviours => behaviours;
public IUniverse Universe { get; private set; } = null!;
public BehaviourCollector() { }
@@ -96,4 +94,7 @@ public class BehaviourCollector<T> : IBehaviourCollector<T> where T : class
OnUnassigned?.Invoke(this);
return true;
}
public int Count => behaviours.Count;
public T this[System.Index index] => behaviours[index];
}