public void UpgradeButton() { if (!playerStats) { NewPlayer(); } if (playerStats == null) { return; } if (playerStats.Wood - buildingStats.GetUpgradeWood() >= 0 && playerStats.Stone - buildingStats.GetUpgradeStone() >= 0) { playerStats.Wood -= buildingStats.GetUpgradeWood(); playerStats.Stone -= buildingStats.GetUpgradeStone(); grabPlayerStats.BuildingBoughtSoldRepairedUpgraded(); buildingStats.CalculateRepairCosts(); UpdateRepairCostAndHealth(); buildingStats.BuildingUpgrade(); } }
public void SellMenuStats() { if (!playerStats) { NewPlayer(); } buildingStats = BuildingPrefab.GetComponent <BuildingStats>(); healthScript = BuildingPrefab.GetComponent <HealthScript>(); txtName.text = buildingStats.Name + " Level " + buildingStats.Level; txtDamage.text = "Damage: " + buildingStats.Damage; txtUpgradePrice.text = "Upgrade: Wood: " + buildingStats.GetUpgradeWood() + ", Stone: " + buildingStats.GetUpgradeStone(); UpdateRepairCostAndHealth(); }