✨ Entity Creation and Scene Management #249
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR produces the features described in issue #244:
ISceneManager
that providesreadonly
access to the currently active/loaded scene.Scene
model that provides the ability to add an entity to the transient injectedIEntityWorld
service.readonly
collection for use with view models.Render
method that simply ensures that all systems that have a execution type ofRender
will be processed.SceneRenderer
has been updated to render the currently active/loadedScene
via theISceneManager
.Closes #244
Dependencies
This PR introduces no new dependencies.
Type of change
How Has This Been Tested?
I have provided unit tests for all testable changes I've made. Final Code Coverage is showing 100% code coverage (obviously excluding any
ExcludeFromCodeCoverage
attributes). All unit tests pass locally on my machine. I've done my best to ensure that this feature is implemented correctly but I will not know until #248 is implemented.Test Configuration:
Proposed Design
Scene Manager
The
ISceneManager
service is provided to access the currently active/loadedScene
. Final Engine doesn't support creating, loading or saving new scenes yet so this is likely to be added in the future. But for now, it is simply an interface to provide access to aScene
model. Currently, a transient scene is passed into theISceneManager
implementation on application startup using the IoC container. This will likely be adjusted in the near future.Scenes
A
Scene
currently provides a way to add entities to anIEntityWorld
(transient) via dependency injection. In the future aScene
will have the ability to serialized and de-serialized to allow for saving and loading of scenes. TheScene
model also provides aRender
function which simply invokesworld.ProcessAll(GameLoopType.Render)
to process all registered entity systems.The
Scene
model also exposes areadonly
collection of entities that will be accessed by the view models implemented in #248 when we address the front-end UI logic. An entity is added to both the injectedIEntityWorld
service and the collection that is initialized in the models constructor. The reasoning for this design decision is to make sure that the end-user cannot enumerate over an entities components as that is a job an entity system.Possible Issues
I'm sure there will be some issue that will arise and can be addressed in the future but for now I think this is mostly boilerplate code. Most things I can think of are UI specific and should not be listed here and instead will be addressed when #248 is implemented.
Checklist: