feat: IBehaviourController Enumarable<IGameObject>
This commit is contained in:
parent
8269c789a6
commit
01a99daf8a
|
@ -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.
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue