-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: init rect collision feat & sys * chore: draw rect collision component & conditional debug * feat!: draft. collision working * refactor: collision system split wit debugging * feat: fixed time step * chore: entities spawn pos changed
- Loading branch information
Showing
37 changed files
with
350 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/Apps/GameDesktop/CompositionRoots/DebugFeatures/DebugRootFeatureCompositionRoot.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using Entitas; | ||
using Features.Debugging; | ||
using GameDesktop.Resources.Internal; | ||
using LightInject; | ||
using Serilog; | ||
using Systems.Debugging; | ||
|
||
namespace GameDesktop.CompositionRoots.DebugFeatures; | ||
|
||
internal class DebugRootFeatureCompositionRoot : ICompositionRoot | ||
{ | ||
private static readonly IMatcher<GameEntity>[] Matchers = { GameMatcher.RectangleCollision, GameMatcher.Transform }; | ||
|
||
public void Compose(IServiceRegistry serviceRegistry) | ||
{ | ||
RegisterSystems(serviceRegistry); | ||
RegisterFeature(serviceRegistry); | ||
} | ||
|
||
private static void RegisterSystems(IServiceRegistry serviceRegistry) | ||
{ | ||
serviceRegistry.RegisterSingleton(factory => | ||
{ | ||
var getGroup = | ||
factory.GetInstance<Func<IMatcher<GameEntity>[], IGroup<GameEntity>>>(Matcher.AllOf); | ||
IGroup<GameEntity> group = getGroup(Matchers); | ||
|
||
return new DrawRectangleCollisionComponentsSystem(factory.GetInstance<Contexts>(), group, | ||
factory.GetInstance<ILogger>()); | ||
}); | ||
} | ||
|
||
private static void RegisterFeature(IServiceRegistry serviceRegistry) => | ||
serviceRegistry.RegisterSingleton<DebugRootFeature>(); | ||
} |
10 changes: 7 additions & 3 deletions
10
src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
using Entities; | ||
using Components.Data; | ||
using Entities; | ||
using LightInject; | ||
|
||
namespace GameDesktop.CompositionRoots.Entities; | ||
|
||
public class PlayerEntityCompositionRoot : ICompositionRoot | ||
internal class PlayerEntityCompositionRoot : ICompositionRoot | ||
{ | ||
public void Compose(IServiceRegistry serviceRegistry) | ||
{ | ||
RegisterEntity(serviceRegistry); | ||
} | ||
|
||
private static void RegisterEntity(IServiceRegistry serviceRegistry) => | ||
serviceRegistry.RegisterTransient<PlayerEntity>(); | ||
serviceRegistry.RegisterTransient(factory => new PlayerEntity(factory.GetInstance<Contexts>(), | ||
factory.GetInstance<MovementAnimationComponent>(), | ||
factory.GetInstance<TransformComponent>("Player"), factory.GetInstance<CameraComponent>(), | ||
factory.GetInstance<RectangleCollisionComponent>())); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.