From 5f26fd85fd586f2b84624605bed421b2aaf4f071 Mon Sep 17 00:00:00 2001 From: Nik Cherednik Date: Sat, 6 Jul 2024 00:17:08 +0300 Subject: [PATCH] refactor: factories --- .../Entities/PlayerEntityCompositionRoot.cs | 1 - .../Entities/StaticEntityCompositionRoot.cs | 1 - .../Features/RootFeatureCompositionRoot.cs | 4 +- .../FundamentalCompositionRoot.cs | 10 +++-- .../Factories/AbstractEntityFactory.cs | 41 ----------------- .../Characters/DummyEntityFactory.cs | 40 ----------------- .../Factories/Characters/PlayerFactory.cs | 2 +- .../Entities/Factories/EntitiesFactory.cs | 39 ++++++++++++++++ ...creteEntityFactory.cs => EntityFactory.cs} | 4 +- .../Factories/IAbstractEntityFactory.cs | 3 +- ...reteEntityFactory.cs => IEntityFactory.cs} | 2 +- .../Items/Rocks/AbstractRockFactory.cs | 6 +-- .../Factories/Items/Rocks/PebbleFactory.cs | 2 +- .../Items/Trees/AbstractTreeFactory.cs | 10 ++--- .../Factories/Items/Trees/TreeFactory.cs | 2 +- .../Factories/Meta/WorldEntityFactory.cs | 2 +- .../AsepriteAnimatedCharactersBuilder.cs} | 44 +++++++++++-------- .../Services/Factories/AbstractFactory.cs | 6 --- src/Libs/Services/Movement/Movement.cs | 2 + .../Systems.Debugging.csproj | 7 +-- .../Systems.Debugging/World/EntitiesList.cs | 1 + src/Libs/Systems/WorldInitializer.cs | 4 +- .../UnitTests.Entities/PlayerEntity.cs | 3 +- 23 files changed, 94 insertions(+), 142 deletions(-) delete mode 100644 src/Libs/Entities/Factories/AbstractEntityFactory.cs delete mode 100644 src/Libs/Entities/Factories/Characters/DummyEntityFactory.cs create mode 100644 src/Libs/Entities/Factories/EntitiesFactory.cs rename src/Libs/Entities/Factories/{ConcreteEntityFactory.cs => EntityFactory.cs} (69%) rename src/Libs/Entities/Factories/{IConcreteEntityFactory.cs => IEntityFactory.cs} (60%) rename src/Libs/Services/{Factories/AnimatedCharactersFactory.cs => Builders/AsepriteAnimatedCharactersBuilder.cs} (69%) delete mode 100644 src/Libs/Services/Factories/AbstractFactory.cs diff --git a/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs index f01fa71..6f9ffcb 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs @@ -1,7 +1,6 @@ using Components.Data; using Components.Render.Animation; using Components.Tags; -using Entities.Factories.Characters; using LightInject; [assembly: CompositionRootType(typeof(GameDesktop.CompositionRoots.Entities.PlayerEntityCompositionRoot))] diff --git a/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs index 3c20519..e76d37c 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs @@ -1,6 +1,5 @@ using Components.Data; using Components.Render.Static; -using Entities.Factories.Characters; using LightInject; [assembly: CompositionRootType(typeof(GameDesktop.CompositionRoots.Entities.StaticEntityCompositionRoot))] diff --git a/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs index 4fb55e5..92fbb8b 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs @@ -65,7 +65,7 @@ public void Compose(IServiceRegistry serviceRegistry) serviceRegistry.RegisterSingleton(); serviceRegistry.RegisterSingleton(); - serviceRegistry.RegisterSingleton(); + serviceRegistry.RegisterSingleton(); RegisterEntryPoint(serviceRegistry); } @@ -157,7 +157,7 @@ private static void RegisterEntryPoint(IServiceRegistry serviceRegistry) // factory.GetInstance(), // factory.GetInstance(), // factory.GetInstance(), - factory.GetInstance(), + factory.GetInstance(), factory.GetInstance()) ); }); diff --git a/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs index 59f128d..a5fd1d1 100644 --- a/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs @@ -8,7 +8,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoGame.Aseprite.Sprites; -using Services.Factories; +using Services.Builders; using Services.Math; [assembly: CompositionRootType(typeof(GameDesktop.CompositionRoots.FundamentalCompositionRoot))] @@ -21,7 +21,6 @@ public void Compose(IServiceRegistry serviceRegistry) { RegisterLdtk(serviceRegistry); RegisterAnimationsFactory(serviceRegistry); - serviceRegistry.RegisterSingleton(typeof(AbstractFactory<>)); } private static void RegisterLdtk(IServiceRegistry serviceRegistry) @@ -39,6 +38,7 @@ private static void RegisterLdtk(IServiceRegistry serviceRegistry) private static void RegisterAnimationsFactory(IServiceRegistry serviceRegistry) { + serviceRegistry.RegisterTransient(); // Warning: binding to where T is any type, is dangerous and you should have a different // binding off of implementation overloading, if you wanna pass through a string as an arg. // So, such resolving won't work either: Func, as it'll get it as your string argument is a @@ -46,9 +46,11 @@ private static void RegisterAnimationsFactory(IServiceRegistry serviceRegistry) serviceRegistry.Register>((factory, path, action) => { GraphicsDevice graphicsDevice = factory.GetInstance().GraphicsDevice; - SpriteSheet spriteSheet = AnimatedCharactersFactory.LoadSpriteSheet(graphicsDevice, path); - return AnimatedCharactersFactory.CreateAnimations(spriteSheet, action); + return factory.GetInstance() + .LoadSpriteSheet(graphicsDevice, path) + .CreateAnimations(action) + .Animations; }, "Character"); } } diff --git a/src/Libs/Entities/Factories/AbstractEntityFactory.cs b/src/Libs/Entities/Factories/AbstractEntityFactory.cs deleted file mode 100644 index 59bfcd7..0000000 --- a/src/Libs/Entities/Factories/AbstractEntityFactory.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Entities.Factories.Characters; -using Entities.Factories.Items.Rocks; -using Entities.Factories.Items.Trees; -using LDtk; -using LightInject; -using Scellecs.Morpeh; - -namespace Entities.Factories; - -public class AbstractEntityFactory(IServiceFactory serviceFactory) : IAbstractEntityFactory -{ - private readonly Dictionary _factories = new() - { - { "Player", serviceFactory.GetInstance() }, - { "Rock", serviceFactory.GetInstance() }, - { "Tree", serviceFactory.GetInstance() }, - // { "Default", null } - }; - - public Entity? CreateEntity(EntityInstance entity, World @in) - { - { - if (_factories.TryGetValue(entity._Identifier, out var factory)) - { - return factory.CreateEntity(entity, @in); - } - } - - foreach (var tag in entity._Tags) - { - if (_factories.TryGetValue(tag, out var factory)) - { - return factory.CreateEntity(entity, @in); - } - } - - return null; - // throw new ArgumentException( - // $"{entity._Identifier} ({entity.Iid}) has unknown tag(-s): {(string.Join(", ", entity._Tags))}"); - } -} diff --git a/src/Libs/Entities/Factories/Characters/DummyEntityFactory.cs b/src/Libs/Entities/Factories/Characters/DummyEntityFactory.cs deleted file mode 100644 index e4c12a0..0000000 --- a/src/Libs/Entities/Factories/Characters/DummyEntityFactory.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Components.Data; -using Components.Render.Static; -using Scellecs.Morpeh; -using Scellecs.Morpeh.Extended.Extensions; - -namespace Entities.Factories.Characters; - -// public class DummyEntityFactory( -// NameComponent name, -// TransformComponent transform, -// RectangleColliderComponent rectangleCollider) -// : EntityFactory -// { -// private readonly SpriteComponent _sprite; -// -// public DummyEntityFactory( -// NameComponent name, -// TransformComponent transform, -// SpriteComponent sprite, -// RectangleColliderComponent rectangleCollider) : this(name, transform, rectangleCollider) -// { -// _sprite = sprite; -// } -// -// protected override void AddTags(Entity e) -// { -// } -// -// protected override void AddData(Entity e) -// { -// e.AddComponent(name); -// e.AddComponent(transform); -// e.AddComponent(rectangleCollider); -// } -// -// protected override void AddRender(Entity e) -// { -// e.AddComponent(_sprite); -// } -// } diff --git a/src/Libs/Entities/Factories/Characters/PlayerFactory.cs b/src/Libs/Entities/Factories/Characters/PlayerFactory.cs index 66aad64..b4a93e9 100644 --- a/src/Libs/Entities/Factories/Characters/PlayerFactory.cs +++ b/src/Libs/Entities/Factories/Characters/PlayerFactory.cs @@ -7,7 +7,7 @@ namespace Entities.Factories.Characters; -public class PlayerFactory(IServiceFactory serviceFactory) : ConcreteEntityFactory +public class PlayerFactory(IServiceFactory serviceFactory) : EntityFactory { protected override void AddTags(Entity e) { diff --git a/src/Libs/Entities/Factories/EntitiesFactory.cs b/src/Libs/Entities/Factories/EntitiesFactory.cs new file mode 100644 index 0000000..9225f0a --- /dev/null +++ b/src/Libs/Entities/Factories/EntitiesFactory.cs @@ -0,0 +1,39 @@ +using Entities.Factories.Characters; +using Entities.Factories.Items.Rocks; +using Entities.Factories.Items.Trees; +using LDtk; +using LightInject; +using Scellecs.Morpeh; + +namespace Entities.Factories; + +public class EntitiesFactory(IServiceFactory serviceFactory) : IAbstractEntityFactory +{ + private readonly Dictionary _abstractFactories = new() + { + { "Rock", serviceFactory.GetInstance() }, + { "Tree", serviceFactory.GetInstance() }, + // { "Default", null } + }; + + private readonly Dictionary _concreteFactories = new() + { + { "Player", serviceFactory.GetInstance() }, + // { "Default", null } + }; + + public Entity? CreateEntity(EntityInstance entity, World @in) => CreateEntity(entity._Identifier, @in) ?? + entity._Tags + .Select(tag => + CreateEntity(entity._Identifier, @in)) + .OfType().FirstOrDefault(); + + public Entity? CreateEntity(string tag, World @in) + { + if (_abstractFactories.TryGetValue(tag, out var @abstract)) return @abstract.CreateEntity(tag, @in); + + if (_concreteFactories.TryGetValue(tag, out var concrete)) return concrete.CreateEntity(@in); + + return null; + } +} diff --git a/src/Libs/Entities/Factories/ConcreteEntityFactory.cs b/src/Libs/Entities/Factories/EntityFactory.cs similarity index 69% rename from src/Libs/Entities/Factories/ConcreteEntityFactory.cs rename to src/Libs/Entities/Factories/EntityFactory.cs index 726d664..7c773f3 100644 --- a/src/Libs/Entities/Factories/ConcreteEntityFactory.cs +++ b/src/Libs/Entities/Factories/EntityFactory.cs @@ -3,7 +3,7 @@ namespace Entities.Factories; -public abstract class ConcreteEntityFactory : IConcreteEntityFactory +public abstract class EntityFactory : IEntityFactory { public Entity CreateEntity(World @in) { @@ -16,8 +16,6 @@ public Entity CreateEntity(World @in) return e; } - public virtual Entity CreateEntity(EntityInstance entity, World @in) => this.CreateEntity(@in); - protected abstract void AddTags(Entity e); protected abstract void AddData(Entity e); diff --git a/src/Libs/Entities/Factories/IAbstractEntityFactory.cs b/src/Libs/Entities/Factories/IAbstractEntityFactory.cs index 5f49776..28d6bb9 100644 --- a/src/Libs/Entities/Factories/IAbstractEntityFactory.cs +++ b/src/Libs/Entities/Factories/IAbstractEntityFactory.cs @@ -5,6 +5,5 @@ namespace Entities.Factories; public interface IAbstractEntityFactory { - // Entity? CreateEntity(string tag, World @in); - Entity? CreateEntity(EntityInstance entity, World @in); + Entity? CreateEntity(string tag, World @in); } diff --git a/src/Libs/Entities/Factories/IConcreteEntityFactory.cs b/src/Libs/Entities/Factories/IEntityFactory.cs similarity index 60% rename from src/Libs/Entities/Factories/IConcreteEntityFactory.cs rename to src/Libs/Entities/Factories/IEntityFactory.cs index a58f935..d095b49 100644 --- a/src/Libs/Entities/Factories/IConcreteEntityFactory.cs +++ b/src/Libs/Entities/Factories/IEntityFactory.cs @@ -2,7 +2,7 @@ namespace Entities.Factories; -public interface IConcreteEntityFactory : IAbstractEntityFactory +public interface IEntityFactory { Entity CreateEntity(World @in); } diff --git a/src/Libs/Entities/Factories/Items/Rocks/AbstractRockFactory.cs b/src/Libs/Entities/Factories/Items/Rocks/AbstractRockFactory.cs index 0d7063e..4c210df 100644 --- a/src/Libs/Entities/Factories/Items/Rocks/AbstractRockFactory.cs +++ b/src/Libs/Entities/Factories/Items/Rocks/AbstractRockFactory.cs @@ -6,13 +6,13 @@ namespace Entities.Factories.Items.Rocks; public class AbstractRockFactory(IServiceFactory serviceFactory) : IAbstractEntityFactory { - private readonly Dictionary _factories = new() + private readonly Dictionary _factories = new() { { "Pebble", serviceFactory.GetInstance() }, }; - public Entity? CreateEntity(EntityInstance entity, World @in) => - _factories.TryGetValue(entity._Identifier, out var factory) + public Entity? CreateEntity(string tag, World @in) => + _factories.TryGetValue(tag, out var factory) ? factory.CreateEntity(@in) : null; } diff --git a/src/Libs/Entities/Factories/Items/Rocks/PebbleFactory.cs b/src/Libs/Entities/Factories/Items/Rocks/PebbleFactory.cs index 6a29f38..de282a7 100644 --- a/src/Libs/Entities/Factories/Items/Rocks/PebbleFactory.cs +++ b/src/Libs/Entities/Factories/Items/Rocks/PebbleFactory.cs @@ -6,7 +6,7 @@ namespace Entities.Factories.Items.Rocks; -public class PebbleFactory(IServiceFactory serviceProvider) : ConcreteEntityFactory +public class PebbleFactory(IServiceFactory serviceProvider) : EntityFactory { protected override void AddTags(Entity e) { diff --git a/src/Libs/Entities/Factories/Items/Trees/AbstractTreeFactory.cs b/src/Libs/Entities/Factories/Items/Trees/AbstractTreeFactory.cs index 8b3778d..725bde9 100644 --- a/src/Libs/Entities/Factories/Items/Trees/AbstractTreeFactory.cs +++ b/src/Libs/Entities/Factories/Items/Trees/AbstractTreeFactory.cs @@ -1,19 +1,17 @@ -using Entities.Factories.Items.Rocks; -using LDtk; -using LightInject; +using LightInject; using Scellecs.Morpeh; namespace Entities.Factories.Items.Trees; public class AbstractTreeFactory(IServiceFactory serviceFactory) : IAbstractEntityFactory { - private readonly Dictionary _factories = new() + private readonly Dictionary _factories = new() { { "Tree", serviceFactory.GetInstance() }, }; - public Entity? CreateEntity(EntityInstance entity, World @in) => - _factories.TryGetValue(entity._Identifier, out var factory) + public Entity? CreateEntity(string tag, World @in) => + _factories.TryGetValue(tag, out var factory) ? factory.CreateEntity(@in) : null; } diff --git a/src/Libs/Entities/Factories/Items/Trees/TreeFactory.cs b/src/Libs/Entities/Factories/Items/Trees/TreeFactory.cs index 2841577..623d78e 100644 --- a/src/Libs/Entities/Factories/Items/Trees/TreeFactory.cs +++ b/src/Libs/Entities/Factories/Items/Trees/TreeFactory.cs @@ -7,7 +7,7 @@ namespace Entities.Factories.Items.Trees; -public class TreeFactory(IServiceFactory serviceProvider) : ConcreteEntityFactory +public class TreeFactory(IServiceFactory serviceProvider) : EntityFactory { protected override void AddTags(Entity e) { diff --git a/src/Libs/Entities/Factories/Meta/WorldEntityFactory.cs b/src/Libs/Entities/Factories/Meta/WorldEntityFactory.cs index 6ad8863..3090fd9 100644 --- a/src/Libs/Entities/Factories/Meta/WorldEntityFactory.cs +++ b/src/Libs/Entities/Factories/Meta/WorldEntityFactory.cs @@ -4,7 +4,7 @@ namespace Entities.Factories.Meta; -public class WorldEntityFactory(WorldMetaComponent worldMetaComponent) : ConcreteEntityFactory +public class WorldEntityFactory(WorldMetaComponent worldMetaComponent) : EntityFactory { protected override void AddTags(Entity e) { diff --git a/src/Libs/Services/Factories/AnimatedCharactersFactory.cs b/src/Libs/Services/Builders/AsepriteAnimatedCharactersBuilder.cs similarity index 69% rename from src/Libs/Services/Factories/AnimatedCharactersFactory.cs rename to src/Libs/Services/Builders/AsepriteAnimatedCharactersBuilder.cs index 596ebb1..27b7e16 100644 --- a/src/Libs/Services/Factories/AnimatedCharactersFactory.cs +++ b/src/Libs/Services/Builders/AsepriteAnimatedCharactersBuilder.cs @@ -4,17 +4,37 @@ using MonoGame.Aseprite.Sprites; using Services.Math; -namespace Services.Factories; +namespace Services.Builders; -public static class AnimatedCharactersFactory +public class AsepriteAnimatedCharactersBuilder { + public Dictionary? Animations { get; private set; } + + private SpriteSheet? _spriteSheet; + private static readonly IReadOnlyList Directions = new[] { Sector.Right, Sector.Down, Sector.Left, Sector.Up }; - public static SpriteSheet LoadSpriteSheet(GraphicsDevice graphicsDevice, string path) + public AsepriteAnimatedCharactersBuilder LoadSpriteSheet(GraphicsDevice graphicsDevice, string path) { AsepriteFile asepriteFile = AsepriteFile.Load(path); - return SpriteSheetProcessor.Process(graphicsDevice, asepriteFile); + return new() { _spriteSheet = SpriteSheetProcessor.Process(graphicsDevice, asepriteFile) }; + } + + public AsepriteAnimatedCharactersBuilder CreateAnimations(string action) + { + if (_spriteSheet is null) throw new ArgumentNullException(); + + Dictionary dictionary = + Directions.ToDictionary(dir => dir, dir => CreateAnimation(_spriteSheet, action, dir)); + + // Temp hack + dictionary.Add(Sector.DownLeft, dictionary[Sector.Left]); + dictionary.Add(Sector.DownRight, dictionary[Sector.Right]); + dictionary.Add(Sector.UpLeft, dictionary[Sector.Left]); + dictionary.Add(Sector.UpRight, dictionary[Sector.Right]); + + return new() { Animations = dictionary }; } private static string BuildTag(string action, Sector dir) => $"{action}{dir.ToString()}"; @@ -23,7 +43,7 @@ private static AnimatedSprite CreateAnimation(SpriteSheet spriteSheet, string ac { AnimatedSprite animatedSprite; - if (direction == Sector.Left) + if (direction is Sector.Left) { string rightAnimationTag = BuildTag(action, Sector.Right); @@ -40,18 +60,4 @@ private static AnimatedSprite CreateAnimation(SpriteSheet spriteSheet, string ac return animatedSprite; } - - public static Dictionary CreateAnimations(SpriteSheet spriteSheet, string action) - { - Dictionary dictionary = - Directions.ToDictionary(dir => dir, dir => CreateAnimation(spriteSheet, action, dir)); - - // Temp hack - dictionary.Add(Sector.DownLeft, dictionary[Sector.Left]); - dictionary.Add(Sector.DownRight, dictionary[Sector.Right]); - dictionary.Add(Sector.UpLeft, dictionary[Sector.Left]); - dictionary.Add(Sector.UpRight, dictionary[Sector.Right]); - - return dictionary; - } } diff --git a/src/Libs/Services/Factories/AbstractFactory.cs b/src/Libs/Services/Factories/AbstractFactory.cs deleted file mode 100644 index 898dc22..0000000 --- a/src/Libs/Services/Factories/AbstractFactory.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Services.Factories; - -public class AbstractFactory(Func factory) -{ - public T Create() => factory(); -} diff --git a/src/Libs/Services/Movement/Movement.cs b/src/Libs/Services/Movement/Movement.cs index 053ac14..64169c8 100644 --- a/src/Libs/Services/Movement/Movement.cs +++ b/src/Libs/Services/Movement/Movement.cs @@ -4,6 +4,8 @@ namespace Services.Movement; public class SimpleMovement : IMovement { + /// You won't see difference by passing computed values, + /// as the parameter is only for a unit vector (e.g. velocity) public Vector2 Move(Vector2 from, Vector2 by, float speed = 1) { if (by.Equals(Vector2.Zero)) return from; diff --git a/src/Libs/Systems.Debugging/Systems.Debugging.csproj b/src/Libs/Systems.Debugging/Systems.Debugging.csproj index 104cc2a..f2ed5da 100644 --- a/src/Libs/Systems.Debugging/Systems.Debugging.csproj +++ b/src/Libs/Systems.Debugging/Systems.Debugging.csproj @@ -15,12 +15,7 @@ - - - - - ..\..\..\..\..\.nuget\packages\lightinject\6.6.4\lib\net6.0\LightInject.dll - + diff --git a/src/Libs/Systems.Debugging/World/EntitiesList.cs b/src/Libs/Systems.Debugging/World/EntitiesList.cs index 632972a..77c2579 100644 --- a/src/Libs/Systems.Debugging/World/EntitiesList.cs +++ b/src/Libs/Systems.Debugging/World/EntitiesList.cs @@ -16,6 +16,7 @@ public class EntitiesList(Scellecs.Morpeh.World world) : IRenderSystem static readonly Dictionary Types = new() { + // TODO: Auto-generated { typeof(InventoryComponent), "Inventory" }, { typeof(TransformComponent), "Transform" }, { typeof(CameraComponent), "Camera" }, diff --git a/src/Libs/Systems/WorldInitializer.cs b/src/Libs/Systems/WorldInitializer.cs index 5799990..224db52 100644 --- a/src/Libs/Systems/WorldInitializer.cs +++ b/src/Libs/Systems/WorldInitializer.cs @@ -9,7 +9,7 @@ namespace Systems; public class WorldInitializer( World world, - AbstractEntityFactory abstractEntityFactory, + EntitiesFactory entitiesFactory, LDtkFile ldtkFile) : IInitializer { @@ -45,7 +45,7 @@ public void OnAwake() foreach (var entity in layer.EntityInstances) { - var e = abstractEntityFactory.CreateEntity(entity, world); + var e = entitiesFactory.CreateEntity(entity, World); if (e is null) continue; diff --git a/src/UnitTests/UnitTests.Entities/PlayerEntity.cs b/src/UnitTests/UnitTests.Entities/PlayerEntity.cs index 34cfe8c..69ba535 100644 --- a/src/UnitTests/UnitTests.Entities/PlayerEntity.cs +++ b/src/UnitTests/UnitTests.Entities/PlayerEntity.cs @@ -5,6 +5,7 @@ namespace UnitTests.Entities; +// Research: https://github.com/MonoGame/MonoGame/tree/develop/Tests public class Tests { private World _world; @@ -25,7 +26,7 @@ public Tests() _serviceContainer.RegisterInstance((IServiceFactory)_serviceContainer); - _serviceContainer.RegisterSingleton(); + _serviceContainer.RegisterSingleton(); _serviceContainer.RegisterSingleton(); }