Add basic tutorial

This commit is contained in:
2024-08-19 01:51:02 +02:00
parent 6171f3e1f4
commit c77eb3cdb5
5 changed files with 1489 additions and 33 deletions

View File

@@ -9,6 +9,10 @@ public class HouseManager : MonoBehaviour
private float currentTtnw = 0;
private int workerPerHouse = 3;
private GameManager gameManager;
//House cost: Brick Tile Glass
public int[] cost = new int[3] { 10, 5, 2 };
// Start is called before the first frame update
void Start()
{
@@ -36,17 +40,17 @@ public class HouseManager : MonoBehaviour
public void BuildHouse()
{
if (gameManager.GetResourceCount(Resource.BRICK) < 10 ||
gameManager.GetResourceCount(Resource.TILE) < 5 ||
gameManager.GetResourceCount(Resource.GLASS) < 2)
if (gameManager.GetResourceCount(Resource.BRICK) < cost[0] ||
gameManager.GetResourceCount(Resource.TILE) < cost[1] ||
gameManager.GetResourceCount(Resource.GLASS) < cost[2])
{
Debug.Log("Not enough resources to build house!");
return;
}
gameManager.RemoveResource(Resource.BRICK, 10);
gameManager.RemoveResource(Resource.TILE, 5);
gameManager.RemoveResource(Resource.GLASS, 2);
gameManager.RemoveResource(Resource.BRICK, cost[0]);
gameManager.RemoveResource(Resource.TILE, cost[1]);
gameManager.RemoveResource(Resource.GLASS, cost[2]);
gameManager.AddResource(Resource.HOUSE, 1);
}
}