refactor: made factories static
This commit is contained in:
@@ -5,10 +5,10 @@ namespace Syntriax.Engine.Core.Factory;
|
||||
|
||||
public class BehaviourControllerFactory
|
||||
{
|
||||
public IBehaviourController Instantiate(IHierarchyObject hierarchyObject)
|
||||
public static IBehaviourController Instantiate(IHierarchyObject hierarchyObject)
|
||||
=> Instantiate<BehaviourController>(hierarchyObject);
|
||||
|
||||
public T Instantiate<T>(IHierarchyObject hierarchyObject, params object?[]? args)
|
||||
public static T Instantiate<T>(IHierarchyObject hierarchyObject, params object?[]? args)
|
||||
where T : class, IBehaviourController
|
||||
{
|
||||
T behaviourController = TypeFactory.Get<T>(args);
|
||||
|
@@ -5,10 +5,10 @@ namespace Syntriax.Engine.Core.Factory;
|
||||
|
||||
public class BehaviourFactory
|
||||
{
|
||||
public T Instantiate<T>(IHierarchyObject hierarchyObject, params object?[]? args) where T : class, IBehaviour
|
||||
public static T Instantiate<T>(IHierarchyObject hierarchyObject, params object?[]? args) where T : class, IBehaviour
|
||||
=> Instantiate<T>(hierarchyObject, stateEnable: null, args);
|
||||
|
||||
public T Instantiate<T>(IHierarchyObject hierarchyObject, IStateEnable? stateEnable, params object?[]? args)
|
||||
public static T Instantiate<T>(IHierarchyObject hierarchyObject, IStateEnable? stateEnable, params object?[]? args)
|
||||
where T : class, IBehaviour
|
||||
{
|
||||
T behaviour = TypeFactory.Get<T>(args);
|
||||
|
@@ -5,10 +5,10 @@ namespace Syntriax.Engine.Core.Factory;
|
||||
|
||||
public class HierarchyObjectFactory
|
||||
{
|
||||
public T Instantiate<T>(params object?[]? args) where T : class, IHierarchyObject
|
||||
public static T Instantiate<T>(params object?[]? args) where T : class, IHierarchyObject
|
||||
=> Instantiate<T>(behaviourController: null, stateEnable: null, args);
|
||||
|
||||
public T Instantiate<T>(
|
||||
public static T Instantiate<T>(
|
||||
IBehaviourController? behaviourController = null,
|
||||
IStateEnable? stateEnable = null,
|
||||
params object?[]? args
|
||||
|
@@ -5,9 +5,9 @@ namespace Syntriax.Engine.Core.Factory;
|
||||
|
||||
public class StateEnableFactory
|
||||
{
|
||||
public IStateEnable Instantiate(IEntity entity) => Instantiate<StateEnable>(entity);
|
||||
public static IStateEnable Instantiate(IEntity entity) => Instantiate<StateEnable>(entity);
|
||||
|
||||
public T Instantiate<T>(IEntity entity, params object?[]? args) where T : class, IStateEnable
|
||||
public static T Instantiate<T>(IEntity entity, params object?[]? args) where T : class, IStateEnable
|
||||
{
|
||||
T stateEnable = TypeFactory.Get<T>(args);
|
||||
|
||||
|
@@ -4,7 +4,7 @@ namespace Syntriax.Engine.Core.Factory;
|
||||
|
||||
public class TransformFactory
|
||||
{
|
||||
public ITransform2D Instantiate() => TypeFactory.Get<Transform2D>();
|
||||
public T Instantiate<T>(params object?[]? args) where T : class, ITransform2D
|
||||
public static ITransform2D Instantiate() => TypeFactory.Get<Transform2D>();
|
||||
public static T Instantiate<T>(params object?[]? args) where T : class, ITransform2D
|
||||
=> TypeFactory.Get<T>(args);
|
||||
}
|
||||
|
Reference in New Issue
Block a user