feat: IBehaviourController Enumarable<IGameObject>

This commit is contained in:
Syntriax 2024-01-30 18:54:12 +03:00
parent 8269c789a6
commit 01a99daf8a
2 changed files with 5 additions and 1 deletions

View File

@ -7,7 +7,7 @@ namespace Syntriax.Engine.Core.Abstract;
/// <summary> /// <summary>
/// Responsible for controlling <see cref="IBehaviour"/>s and notify them accordingly about the engine's updates. Connected to an <see cref="IGameObject"/>. /// Responsible for controlling <see cref="IBehaviour"/>s and notify them accordingly about the engine's updates. Connected to an <see cref="IGameObject"/>.
/// </summary> /// </summary>
public interface IBehaviourController : IAssignableGameObject public interface IBehaviourController : IAssignableGameObject, IEnumerable<IBehaviour>
{ {
/// <summary> /// <summary>
/// Callback triggered when the <see cref="Update()"/> is called but right before the <see cref="OnUpdate"/> action is triggered. /// Callback triggered when the <see cref="Update()"/> is called but right before the <see cref="OnUpdate"/> action is triggered.

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Linq; using System.Linq;
@ -169,4 +170,7 @@ public class BehaviourController : IBehaviourController
behaviours.Remove(behaviour); behaviours.Remove(behaviour);
InsertBehaviourByPriority(behaviour); InsertBehaviourByPriority(behaviour);
} }
public IEnumerator<IBehaviour> GetEnumerator() => behaviours.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => behaviours.GetEnumerator();
} }