Added functionality to main menu
This commit is contained in:
@@ -53,7 +53,7 @@ namespace Fruitomation.Game
|
||||
Buildings = buildings.ToArray();
|
||||
}
|
||||
|
||||
private static string Filepath => Path.Combine(Application.persistentDataPath, "buildings.json");
|
||||
public static string Filepath => Path.Combine(Application.persistentDataPath, "buildings.json");
|
||||
|
||||
private bool[,] InhabitedCells { get; } = new bool[96, 49];
|
||||
private List<Building> Buildings { get; } = new();
|
||||
@@ -84,6 +84,11 @@ namespace Fruitomation.Game
|
||||
}
|
||||
|
||||
string json = File.ReadAllText(Filepath);
|
||||
if (json == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SerializedBuilding[] buildings = JsonUtility.FromJson<SerializedBuildings>(json).Get();
|
||||
|
||||
foreach (SerializedBuilding building in buildings)
|
||||
@@ -129,7 +134,7 @@ namespace Fruitomation.Game
|
||||
string json = JsonUtility.ToJson(new SerializedBuildings(serialized), true);
|
||||
File.WriteAllText(Filepath, json);
|
||||
}
|
||||
|
||||
|
||||
public void RemoveBuilding(Building building)
|
||||
{
|
||||
Buildings.Remove(building);
|
||||
|
||||
@@ -190,12 +190,14 @@ namespace Fruitomation.Game
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[MenuItem("Fruitomation/Reset Upgrades")]
|
||||
#endif // UNITY_EDITOR
|
||||
public static void ResetUpgrades()
|
||||
{
|
||||
CurrentUpgrades = new UnlockedUpgrades();
|
||||
CurrentUpgrades.Unlock(BasicUpgrade.Apple); // Always unlocked
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[MenuItem("Fruitomation/Unlock All Upgrades")]
|
||||
public static void UnlockAll()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user