Exemple #1
0
        public void SaveWorld(GameManager.WorldData data)
        {
            data.WorldState = PersistentState;
            data.ZoneStates = new VariableStore[Zones.Length];

            for (var i = 0; i < Zones.Length; i++)
            {
                data.ZoneStates[i] = Zones[i].PersistentState;
            }
        }
Exemple #2
0
        public void LoadWorld(GameManager.WorldData data)
        {
            PersistentState = data.WorldState ?? new VariableStore();

            foreach (var zone in World.Zones)
            {
                if (zone.Scene.Index < 0)
                {
                    Debug.LogFormat("zone {0} does not have a valid scene assigned", zone.name);
                }
                else
                {
                    Zones[zone.Scene.Index].PersistentState = (zone.Scene.Index < data.ZoneStates.Length ? data.ZoneStates[zone.Scene.Index] : null) ?? new VariableStore();
                }
            }
        }