Пример #1
0
    public void SaveWorldState()
    {
        WorldGenerator.WorldDefinition world = WorldGenerator.GetWorld(loadedWorld);

        world.ResetSaveMarkers();
        for (int i = 0; i < Objects.Count; i++)
        {
            if (Objects[i].LoadedObjectDefinition == null || Objects[i] == RocketToSpace.Current)
            {
                continue;
            }

            if (world.Objects.ContainsKey(Objects[i].LoadedObjectDefinition))
            {
                Objects[i].OverwriteObjectDefinition(world.Objects[Objects[i].LoadedObjectDefinition], mapper);
                world.Objects[Objects[i].LoadedObjectDefinition].MarkedAsSaved = true;
            }
            else
            {
                WorldGenerator.WorldObjectDefinition newObj = new WorldGenerator.WorldObjectDefinition();
                Objects[i].OverwriteObjectDefinition(newObj, mapper);
                world.ObjectList.Add(newObj);
                world.Objects[newObj.ID] = newObj;
                newObj.MarkedAsSaved     = true;
            }
        }
        world.DeleteUnsaved();
    }
Пример #2
0
 public virtual void OverwriteObjectDefinition(WorldGenerator.WorldObjectDefinition obj, TileWrappingMapper mapper)
 {
     obj.Position.x = transform.position.x + (WrappingWorld.Current.TileSizeX * (OriginalTile.X - mapper.GetNewX(OriginalTile.X)));
     obj.Position.y = transform.position.y + (WrappingWorld.Current.TileSizeY * (OriginalTile.Y - mapper.GetNewY(OriginalTile.Y)));
 }
Пример #3
0
 public override void OverwriteObjectDefinition(WorldGenerator.WorldObjectDefinition obj, TileWrappingMapper mapper)
 {
     base.OverwriteObjectDefinition(obj, mapper);
     obj.Type = ObjectType.FuelPickup;
 }
Пример #4
0
 public override void OverwriteObjectDefinition(WorldGenerator.WorldObjectDefinition obj, TileWrappingMapper mapper)
 {
     base.OverwriteObjectDefinition(obj, mapper);
     obj.Type = ObjectType.FuelTree;
     obj.RemainingIntValue = Fuels;
 }