Added a scene controller
This commit is contained in:
@@ -28,7 +28,6 @@ namespace Fruitomation.Game
|
||||
|
||||
[UsedImplicitly, Preserve, InspectorCallable("Click Building")] public void OnBuildingClicked()
|
||||
{
|
||||
Debug.Log($"Building clicked {gameObject.name}");
|
||||
if (GameStateController.Is(GameState.Editing))
|
||||
{
|
||||
Manager.RemoveBuilding(this);
|
||||
|
||||
@@ -82,6 +82,12 @@ namespace Fruitomation.Game
|
||||
|
||||
info.Building.Init(this, building.GridPosition, building.Position, building.IsFlipped);
|
||||
Buildings.Add(info.Building);
|
||||
|
||||
for (int x = building.GridPosition.x; x < building.GridPosition.x + info.Building.SizeOnGrid.x; x++)
|
||||
for (int y = building.GridPosition.y; y < building.GridPosition.y + info.Building.SizeOnGrid.y; y++)
|
||||
{
|
||||
InhabitedCells[x, y] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +104,7 @@ namespace Fruitomation.Game
|
||||
)
|
||||
).ToList();
|
||||
|
||||
string json = JsonUtility.ToJson(new SerializedBuildings(serialized), false);
|
||||
string json = JsonUtility.ToJson(new SerializedBuildings(serialized), true);
|
||||
File.WriteAllText(Filepath, json);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user