Game Context Hotfix

This commit is contained in:
hyperion51 2020-04-17 01:38:48 +01:00
commit 43d5ebdd35
2 changed files with 8 additions and 4 deletions

View file

@ -56,7 +56,7 @@ public class GameContext
var planetsData = zoneData.Planets.Select(id => Cache.Get<PlanetData>(id)).ToArray();
var planetEntities = planetsData.ToDictionary(p => p,
p => new OrbitalEntity(this, Enumerable.Empty<Gear>(), Enumerable.Empty<ItemInstance>(), p.Orbit));
p => new OrbitalEntity(this, Enumerable.Empty<Gear>(), Enumerable.Empty<ItemInstance>(), p.Belt ? Cache.Get<OrbitData>(p.Orbit).Parent : p.Orbit));
foreach(var kvp in planetEntities)
contents.Add(kvp.Key, kvp.Value);
@ -73,6 +73,7 @@ public class GameContext
public void Update()
{
OrbitalEntity.ClearOrbits();
foreach (var kvp in ZoneContents)
{
var zone = kvp.Key;

View file

@ -107,7 +107,7 @@ public class StrategyGameManager : MonoBehaviour
if (_currentTab == ZoneTabButton)
{
if (_populatedZone != _selectedZone)
if (_populatedZone != _selectedZone && _cache.Get<ZoneData>(_selectedZone) != null)
PopulateZone();
Camera.transform.position = -Vector3.forward;
}
@ -129,8 +129,11 @@ public class StrategyGameManager : MonoBehaviour
private void Update()
{
_context.Time = Time.time;
_context.Update();
if (_context != null)
{
_context.Time = Time.time;
_context.Update();
}
if (_currentTab == GalaxyTabButton)
{
_galaxyCameraPos = Camera.transform.position;