Entity Persistence Refactoring

Entities refactored to enable robust persistence
Entities detect stale data references and reload behaviors
This commit is contained in:
hyperion51 2020-05-06 04:56:36 +01:00
commit 6aeb2ae280
29 changed files with 299 additions and 202 deletions

View file

@ -519,10 +519,10 @@ public class StrategyGameManager : MonoBehaviour
if (args[0] == "ship")
{
var entity = new Ship(_context, hull, gear, Enumerable.Empty<ItemInstance>());
var entity = new Ship(_context, hull.ID, gear.Select(i=>i.ID), Enumerable.Empty<Guid>());
_context.Cache.Add(entity);
_context.ZoneEntities[_populatedZone][entity.ID] = entity;
_context.Agents.Add(new AgentController(_context, _populatedZone, entity));
_context.Agents.Add(new AgentController(_context, _populatedZone, entity.ID));
var zoneShip = Instantiate(ZoneShipPrefab, ZoneRoot);
zoneShip.Label.text = $"Ship {_zoneShips.Count}";
_zoneShips[entity] = zoneShip;