public void LoadGame()
{
var jsonFormatData = saveSystem.LoadData();
if (String.IsNullOrEmpty(jsonFormatData))
{
return;
}
SaveDataSerialization saveData = JsonUtility.FromJson <SaveDataSerialization>(jsonFormatData);
structureManager.ClearMap();
foreach (var structureData in saveData.structuresData)
{
Vector3Int position = Vector3Int.RoundToInt(structureData.position.GetValue());
if (structureData.buildingType == CellType.Road)
{
roadManager.PlaceRoad(position);
roadManager.FinishPlacingRoad();
}
else
{
structureManager.PlaceLoadedStructure(position, structureData.buildingPrefabindex, structureData.buildingType);
}
}
}