Development Merge 2025.04.01 #1
@ -14,12 +14,12 @@ public class BehaviourCollector<T> : IBehaviourCollector<T> where T : class
|
||||
public event IBehaviourCollector<T>.CollectedEventHandler? OnCollected = null;
|
||||
public event IBehaviourCollector<T>.RemovedEventHandler? OnRemoved = null;
|
||||
|
||||
protected readonly List<T> _behaviours = new(32);
|
||||
protected readonly List<T> behaviours = new(32);
|
||||
|
||||
public IReadOnlyList<T> Behaviours => _behaviours;
|
||||
public IReadOnlyList<T> Behaviours => behaviours;
|
||||
public IGameManager GameManager { get; private set; } = null!;
|
||||
|
||||
public T this[Index index] => _behaviours[index];
|
||||
public T this[Index index] => behaviours[index];
|
||||
|
||||
public BehaviourCollector() { }
|
||||
public BehaviourCollector(IGameManager gameManager) => Assign(gameManager);
|
||||
@ -48,7 +48,7 @@ public class BehaviourCollector<T> : IBehaviourCollector<T> where T : class
|
||||
if (behaviour is not T tBehaviour)
|
||||
return;
|
||||
|
||||
_behaviours.Add(tBehaviour);
|
||||
behaviours.Add(tBehaviour);
|
||||
OnBehaviourAdd(behaviour);
|
||||
OnCollected?.Invoke(this, tBehaviour);
|
||||
}
|
||||
@ -59,7 +59,7 @@ public class BehaviourCollector<T> : IBehaviourCollector<T> where T : class
|
||||
if (behaviour is not T tBehaviour)
|
||||
return;
|
||||
|
||||
if (!_behaviours.Remove(tBehaviour))
|
||||
if (!behaviours.Remove(tBehaviour))
|
||||
return;
|
||||
|
||||
OnBehaviourRemove(behaviour);
|
||||
@ -99,6 +99,6 @@ public class BehaviourCollector<T> : IBehaviourCollector<T> where T : class
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator() => _behaviours.GetEnumerator();
|
||||
IEnumerator IEnumerable.GetEnumerator() => _behaviours.GetEnumerator();
|
||||
public IEnumerator<T> GetEnumerator() => behaviours.GetEnumerator();
|
||||
IEnumerator IEnumerable.GetEnumerator() => behaviours.GetEnumerator();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class BehaviourCollectorSorted<T> : BehaviourCollector<T> where T : class
|
||||
protected override void OnBehaviourAdd(IBehaviour behaviour)
|
||||
{
|
||||
if (SortBy is not null)
|
||||
_behaviours.Sort(SortBy);
|
||||
behaviours.Sort(SortBy);
|
||||
}
|
||||
|
||||
public BehaviourCollectorSorted() { }
|
||||
|
Loading…
x
Reference in New Issue
Block a user