LevelData

This commit is contained in:
2023-06-16 09:51:16 +03:00
parent 36f90ddd64
commit d9fbd99072
7 changed files with 100 additions and 15 deletions

View File

@@ -100,14 +100,12 @@ namespace Level
}
else if (placementOption == LevelBuilderButtons.PlacementOption.Crate)
{
cellData.cellContent = LayoutCellData.CellContent.Crate;
GameObject crateObject = GameObject.Instantiate(cratePrefab, worldPos, Quaternion.identity);
crate = crateObject.GetComponent<Crate>();
crate.layoutPosition = layoutPosition;
// This call handles updating cellData as well
PlaceCrate();
}
else if (placementOption == LevelBuilderButtons.PlacementOption.Player)
{
// This call handles updating cellData as well
Player.Instance.Teleport(this);
}
@@ -115,6 +113,16 @@ namespace Level
}
public void PlaceCrate()
{
cellData.cellContent = LayoutCellData.CellContent.Crate;
GameObject crateObject = GameObject.Instantiate(cratePrefab, worldPos, Quaternion.identity);
crate = crateObject.GetComponent<Crate>();
crate.layoutPosition = layoutPosition;
}
public void UpdateSprites()
{
if (cellData.cellContent == LayoutCellData.CellContent.Block)