Level save + load
This commit is contained in:
@@ -31,6 +31,7 @@ namespace Level
|
||||
private int height;
|
||||
private LayoutCell[][] layout;
|
||||
private Vector3Int firstCellPos;
|
||||
private LevelSaveSystem levelSaveSystem = new LevelSaveSystem();
|
||||
|
||||
// Properties
|
||||
public static LevelBuilder Instance => instance;
|
||||
@@ -59,6 +60,11 @@ namespace Level
|
||||
|
||||
EditCellAt(worldMousePosition);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.T))
|
||||
{
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +141,25 @@ namespace Level
|
||||
}
|
||||
|
||||
|
||||
public void Save()
|
||||
{
|
||||
LevelData levelData = CreateLevelData();
|
||||
Save(levelData);
|
||||
}
|
||||
|
||||
|
||||
public void Save(LevelData levelData)
|
||||
{
|
||||
levelSaveSystem.Save(levelData);
|
||||
}
|
||||
|
||||
|
||||
public void Load()
|
||||
{
|
||||
levelSaveSystem.Load();
|
||||
}
|
||||
|
||||
|
||||
public LayoutCell GetCellAtLayout(Vector2Int layoutPosition)
|
||||
{
|
||||
// Check that cell with these indices exists in array
|
||||
|
||||
Reference in New Issue
Block a user