refactor: Removed IEnumerable<GameObjects> from IGameManager

This commit is contained in:
Syntriax 2024-11-16 22:44:45 +03:00
parent 4d59dcb9ab
commit cc4068fa2e
3 changed files with 3 additions and 8 deletions

View File

@ -5,7 +5,7 @@ namespace Syntriax.Engine.Core.Abstract;
/// <summary>
/// Represents a game world responsible for managing <see cref="IGameObject"/>s.
/// </summary>
public interface IGameManager : IEntity, IEnumerable<IGameObject>
public interface IGameManager : IEntity
{
/// <summary>
/// Event triggered when <see cref="Update(EngineTime)"/> is called on the <see cref="IGameManager"/>.

View File

@ -67,7 +67,7 @@ public class BehaviourCollector<T> : IAssignableGameManager, IEnumerable<T>
if (GameManager is not null)
return false;
foreach (IGameObject gameObject in gameManager)
foreach (IGameObject gameObject in gameManager.GameObjects)
OnGameObjectRegistered(gameManager, gameObject);
gameManager.OnGameObjectRegistered += OnGameObjectRegistered;
@ -84,7 +84,7 @@ public class BehaviourCollector<T> : IAssignableGameManager, IEnumerable<T>
if (GameManager is null)
return false;
foreach (IGameObject gameObject in GameManager)
foreach (IGameObject gameObject in GameManager.GameObjects)
OnGameObjectUnregistered(GameManager, gameObject);
GameManager.OnGameObjectRegistered -= OnGameObjectRegistered;

View File

@ -191,9 +191,4 @@ public class GameManager : BaseEntity, IGameManager
if (sender is IGameObject gameObject)
Unregister(gameObject);
}
/////////////////////////////////////////////////////////////////
public IEnumerator<IGameObject> GetEnumerator() => _gameObjects.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => _gameObjects.GetEnumerator();
}