Level save + load

This commit is contained in:
2023-06-16 17:08:56 +03:00
parent d9fbd99072
commit 0eb8b1d4ee
132 changed files with 20138 additions and 15 deletions

View File

@@ -66,12 +66,15 @@ namespace Objects
}
public void Teleport(LayoutCell targetCell)
public void Teleport(LayoutCell targetCell, bool clearOldCell=true)
{
LayoutCell currentCell = LevelBuilder.Instance.GetCellAtLayout(layoutPosition);
// Free previous cell
currentCell.cellData.cellContent = LayoutCell.LayoutCellData.CellContent.None;
if (clearOldCell)
{
// Free previous cell
currentCell.cellData.cellContent = LayoutCell.LayoutCellData.CellContent.None;
}
// Occupy new cell
targetCell.cellData.cellContent = LayoutCell.LayoutCellData.CellContent.Player;
@@ -114,7 +117,8 @@ namespace Objects
private void OnLevelInitialized()
{
gameObject.SetActive(true);
Teleport(LevelBuilder.Instance.GetCellAtLayout(new Vector2Int(0, 0)));
Teleport(LevelBuilder.Instance.GetCellAtLayout(new Vector2Int(0, 0)), false);
}