refactor: made factories static
This commit is contained in:
@@ -4,7 +4,6 @@ using System.Collections.Generic;
|
||||
|
||||
using Syntriax.Engine.Core.Abstract;
|
||||
using Syntriax.Engine.Core.Exceptions;
|
||||
using Syntriax.Engine.Core.Factory;
|
||||
|
||||
namespace Syntriax.Engine.Core;
|
||||
|
||||
@@ -19,16 +18,6 @@ public class GameManager : BaseEntity, IGameManager
|
||||
|
||||
private readonly List<IHierarchyObject> _hierarchyObjects = new(Constants.GAME_OBJECTS_SIZE_INITIAL);
|
||||
|
||||
private HierarchyObjectFactory _hierarchyObjectFactory = null!;
|
||||
private HierarchyObjectFactory HierarchyObjectFactory
|
||||
{
|
||||
get
|
||||
{
|
||||
_hierarchyObjectFactory ??= new HierarchyObjectFactory();
|
||||
return _hierarchyObjectFactory;
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<IHierarchyObject> HierarchyObjects => _hierarchyObjects;
|
||||
|
||||
public override IStateEnable StateEnable
|
||||
@@ -37,7 +26,7 @@ public class GameManager : BaseEntity, IGameManager
|
||||
{
|
||||
if (base.StateEnable is null)
|
||||
{
|
||||
Assign(new StateEnableFactory().Instantiate(this));
|
||||
Assign(Factory.StateEnableFactory.Instantiate(this));
|
||||
if (base.StateEnable is null)
|
||||
throw NotAssignedException.From(this, base.StateEnable);
|
||||
}
|
||||
@@ -72,7 +61,7 @@ public class GameManager : BaseEntity, IGameManager
|
||||
|
||||
public T InstantiateHierarchyObject<T>(params object?[]? args) where T : class, IHierarchyObject
|
||||
{
|
||||
T hierarchyObject = HierarchyObjectFactory.Instantiate<T>(args);
|
||||
T hierarchyObject = Factory.HierarchyObjectFactory.Instantiate<T>(args);
|
||||
Register(hierarchyObject);
|
||||
return hierarchyObject;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user