Level save + load
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user