refactor: IBehaviourController.TryGetBehaviour to Extension Method
This commit is contained in:
@@ -10,7 +10,7 @@ public static class BehaviourExtensions
|
||||
public static T? FindBehaviour<T>(this IEnumerable<IGameObject> gameObjects) where T : class
|
||||
{
|
||||
foreach (IGameObject gameObject in gameObjects)
|
||||
if (gameObject.BehaviourController.TryGetBehaviour(out T? behaviour))
|
||||
if (gameObject.BehaviourController.GetBehaviour<T>() is T behaviour)
|
||||
return behaviour;
|
||||
|
||||
return default;
|
||||
|
Reference in New Issue
Block a user