perf!: behaviour controller memory allocation issues fixed by removing the enumerable interface

This commit is contained in:
2025-05-30 12:12:27 +03:00
parent b0f8b0dad6
commit b1b5af94d3
4 changed files with 21 additions and 12 deletions

View File

@@ -17,6 +17,8 @@ public class BehaviourController : BaseEntity, IBehaviourController
private IUniverseObject _universeObject = null!;
public IUniverseObject UniverseObject => _universeObject;
public int Count => behaviours.Count;
public IBehaviour this[Index index] => behaviours[index];
public T AddBehaviour<T>(T behaviour) where T : class, IBehaviour
{
@@ -149,7 +151,4 @@ public class BehaviourController : BaseEntity, IBehaviourController
behaviours.Remove(sender);
InsertBehaviourByPriority(sender);
}
public IEnumerator<IBehaviour> GetEnumerator() => behaviours.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => behaviours.GetEnumerator();
}