Skip to content

Commit

Permalink
updating bootstrapper create API to use ArchetypeProducer
Browse files Browse the repository at this point in the history
  • Loading branch information
tbg10101 committed Apr 25, 2020
1 parent 933c5d5 commit 9399d55
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2020.1.0b5
m_EditorVersionWithRevision: 2020.1.0b5 (f017efceb459)
m_EditorVersion: 2020.1.0b6
m_EditorVersionWithRevision: 2020.1.0b6 (255abb3234f8)
13 changes: 4 additions & 9 deletions Runtime/Scripts/MonoBehaviours/Bootstrapper.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using Software10101.DOTS.Archetypes;
using Software10101.DOTS.Data;
using Software10101.DOTS.Systems;
Expand Down Expand Up @@ -35,7 +34,7 @@ public class Bootstrapper : WorldBehaviour {
[SerializeField]
private ArchetypeProducer[] _prefabs = null;
private EntityArchetype[] _prefabArchetypes = null;
private readonly Dictionary<GameObject ,int> _prefabIndices = new Dictionary<GameObject ,int>();
private readonly Dictionary<ArchetypeProducer ,int> _prefabIndices = new Dictionary<ArchetypeProducer ,int>();

[SerializeField]
private SystemTypeReference[] _simulationSystems = new SystemTypeReference[0];
Expand Down Expand Up @@ -71,19 +70,15 @@ protected virtual void Start() {
for (int i = 0; i < _prefabs.Length; i++) {
ArchetypeProducer p = _prefabs[i];
_prefabArchetypes[i] = p.Produce(entityManager);
_prefabIndices[p.Prefab.gameObject] = i;
_prefabIndices[p] = i;
}
}

internal EntityMonoBehaviour GetPrefab(int prefabIndex) {
return _prefabs[prefabIndex].Prefab;
}

public (Entity, EntityCommandBuffer) Create(Component prefab) {
return Create(_prefabIndices[prefab.gameObject]);
}

public (Entity, EntityCommandBuffer) Create(GameObject prefab) {
public (Entity, EntityCommandBuffer) Create(ArchetypeProducer prefab) {
return Create(_prefabIndices[prefab]);
}

Expand Down
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.2.1",
"version": "0.3.0",
"unity": "2020.1",
"displayName": "DOTS Hybrid Simulation Worlds",
"dependencies": {
Expand Down

0 comments on commit 9399d55

Please sign in to comment.