fix: IBehaviour.GetBehaviours<T>(List)
This commit is contained in:
parent
1b3b999a95
commit
4d59dcb9ab
|
@ -75,8 +75,8 @@ public interface IBehaviourController : IInitialize, IAssignableGameObject, IEnu
|
|||
/// Gets all <see cref="IBehaviour"/>s of the specified type and stores them in the provided list.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of <see cref="IBehaviour"/>s to get.</typeparam>
|
||||
/// <param name="behaviours">The list to store the <see cref="IBehaviour"/>s.</param>
|
||||
void GetBehaviours<T>(List<T> behaviours);
|
||||
/// <param name="results">The list to store the <see cref="IBehaviour"/>s.</param>
|
||||
void GetBehaviours<T>(IList<T> results);
|
||||
|
||||
/// <summary>
|
||||
/// Removes <see cref="IBehaviour"/>s of the specified type from the <see cref="IBehaviourController"/>.
|
||||
|
|
|
@ -95,15 +95,15 @@ public class BehaviourController : IBehaviourController
|
|||
return behaviours ?? Enumerable.Empty<T>().ToList();
|
||||
}
|
||||
|
||||
public void GetBehaviours<T>(List<T> behaviors)
|
||||
public void GetBehaviours<T>(IList<T> results)
|
||||
{
|
||||
behaviors.Clear();
|
||||
results.Clear();
|
||||
foreach (var behaviourItem in behaviours)
|
||||
{
|
||||
if (behaviourItem is not T _)
|
||||
if (behaviourItem is not T behaviour)
|
||||
continue;
|
||||
|
||||
behaviours.Add(behaviourItem);
|
||||
results.Add(behaviour);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue