Skip to content

Commit

Permalink
preliminary version with a group of systems that run before the pre-s…
Browse files Browse the repository at this point in the history
…im ECB, useful for resetting sim state
  • Loading branch information
tbg10101 committed Jan 3, 2021
1 parent b54f288 commit b090618
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 8 deletions.
33 changes: 26 additions & 7 deletions Runtime/Scripts/MonoBehaviours/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ public class Bootstrapper : WorldBehaviour {
private readonly Dictionary<ArchetypeProducer, int> _archetypeProducerIndices = new Dictionary<ArchetypeProducer, int>();

[SerializeField]
private SystemTypeReference[] _simulationSystems = new SystemTypeReference[0];
private SystemTypeReference[] _simulationResetSystems = new SystemTypeReference[0];

[FormerlySerializedAs("_simulationSystems")]
[SerializeField]
private SystemTypeReference[] _mainSimulationSystems = new SystemTypeReference[0];

[FormerlySerializedAs("_presentationSystems")]
[SerializeField]
Expand All @@ -55,9 +59,20 @@ protected virtual void Start() {
{
AddSystem(simGroup, new SimulationDestroySystem());

SimulationResetSystemGroup simResetGroup = AddSystem(simGroup, new SimulationResetSystemGroup());
{
foreach (SystemTypeReference systemTypeReference in _simulationResetSystems) {
GetOrCreateSystem(simResetGroup, systemTypeReference.SystemType);
}
}

AddSystem(simGroup, new PreSimulationEntityCommandBufferSystem());
foreach (SystemTypeReference systemTypeReference in _simulationSystems) {
GetOrCreateSystem(simGroup, systemTypeReference.SystemType);

SimulationMainSystemGroup simMainGroup = AddSystem(simGroup, new SimulationMainSystemGroup());
{
foreach (SystemTypeReference systemTypeReference in _mainSimulationSystems) {
GetOrCreateSystem(simMainGroup, systemTypeReference.SystemType);
}
}

AddSystem(simGroup, new PostSimulationEntityCommandBufferSystem());
Expand All @@ -71,17 +86,21 @@ protected virtual void Start() {
AddSystem(presGroup, new PrePresentationEntityCommandBufferSystem());

PresentationPreUpdateSystemGroup presPreUpdateGroup = AddSystem(presGroup, new PresentationPreUpdateSystemGroup());
foreach (SystemTypeReference systemTypeReference in _presentationPreUpdateSystems) {
GetOrCreateSystem(presPreUpdateGroup, systemTypeReference.SystemType);
{
foreach (SystemTypeReference systemTypeReference in _presentationPreUpdateSystems) {
GetOrCreateSystem(presPreUpdateGroup, systemTypeReference.SystemType);
}
}

AddSystem(presGroup, new PreManagedMonoBehaviourUpdateEntityCommandBufferSystem());
AddSystem(presGroup, new ManagedMonoBehaviourUpdateSystem());
AddSystem(presGroup, new PostManagedMonoBehaviourUpdateEntityCommandBufferSystem());

PresentationPostUpdateSystemGroup presPostUpdateGroup = AddSystem(presGroup, new PresentationPostUpdateSystemGroup());
foreach (SystemTypeReference systemTypeReference in _presentationPostUpdateSystems) {
GetOrCreateSystem(presPostUpdateGroup, systemTypeReference.SystemType);
{
foreach (SystemTypeReference systemTypeReference in _presentationPostUpdateSystems) {
GetOrCreateSystem(presPostUpdateGroup, systemTypeReference.SystemType);
}
}

AddSystem(presGroup, new PostPresentationEntityCommandBufferSystem());
Expand Down
3 changes: 3 additions & 0 deletions Runtime/Scripts/Systems/Groups/SimulationMainSystemGroup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace Software10101.DOTS.Systems.Groups {
internal sealed class SimulationMainSystemGroup : ListComponentSystemGroup { }
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Runtime/Scripts/Systems/Groups/SimulationResetSystemGroup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace Software10101.DOTS.Systems.Groups {
internal sealed class SimulationResetSystemGroup : ListComponentSystemGroup { }
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.10101software.dots.hybridsimulation",
"description": "A framework for using FixedUpdate in a simulation world which is linked to a GameObject-based presentation layer.",
"version": "0.7.4",
"version": "0.7.5-preview.1",
"unity": "2020.2",
"displayName": "DOTS Hybrid Simulation Worlds",
"dependencies": {
Expand Down

0 comments on commit b090618

Please sign in to comment.