Ejemplo n.º 1
0
        void ISavable.Initialize()
        {
            var saveData = LocalSaveData.Game;

            this.Mapper         = new CellMapper();
            this.CellGenerator  = new CellGenerator(this.Mapper, this.parent);
            this.EventGenerator = new CellEventGenerator(this.Mapper);

            if (saveData.Mapper.Exists())
            {
                this.Mapper.Deserialize(saveData.Mapper.Load(), this.CellGenerator, this.EventGenerator);
            }
            else
            {
                foreach (var group in GameSystem.Instance.Constants.GameSystem.InitialCellBundleGroups)
                {
                    this.CellGenerator.GenerateFromCellBundle(group);
                }
            }
        }
Ejemplo n.º 2
0
        public void Deserialize(SerializableCellMapper serializableData, CellGenerator cellGenerator, CellEventGenerator cellEventGenerator)
        {
            Assert.IsNotNull(serializableData);
            Assert.IsNotNull(cellGenerator);
            Assert.IsNotNull(cellEventGenerator);

            foreach (var c in serializableData.Cells)
            {
                cellGenerator.Generate(c.RecordId, c.Position, c.Group);
            }
            foreach (var e in serializableData.CellEvents)
            {
                cellEventGenerator.GenerateOnDeserialize((CellEvent)e);
            }
        }