feat: IEnumerable<IGameObject> to GameManager

This commit is contained in:
Syntriax 2024-01-23 12:06:14 +03:00
parent 39e553ebbf
commit fdb5936573
1 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Syntriax.Engine.Core.Abstract; using Syntriax.Engine.Core.Abstract;
@ -7,7 +8,7 @@ using Syntriax.Engine.Core.Factory;
namespace Syntriax.Engine.Core; namespace Syntriax.Engine.Core;
public class GameManager : IEntity public class GameManager : IEntity, IEnumerable<IGameObject>
{ {
public Action<GameManager>? OnCameraChanged { get; set; } = null; public Action<GameManager>? OnCameraChanged { get; set; } = null;
public Action<IInitialize>? OnInitialized { get; set; } = null; public Action<IInitialize>? OnInitialized { get; set; } = null;
@ -167,4 +168,9 @@ public class GameManager : IEntity
if (initialize is IGameObject gameObject) if (initialize is IGameObject gameObject)
Unregister(gameObject); Unregister(gameObject);
} }
/////////////////////////////////////////////////////////////////
public IEnumerator<IGameObject> GetEnumerator() => _gameObjects.GetEnumerator();
IEnumerator IEnumerable.GetEnumerator() => _gameObjects.GetEnumerator();
} }