Started working on Builder job and building buildings

This commit is contained in:
2026-06-12 12:00:15 +01:00
parent 529b25daf5
commit bd3bb4bc6f
12 changed files with 7599 additions and 6861 deletions

View File

@@ -6,15 +6,16 @@ public class GameManager : MonoBehaviour
{
public Dictionary<Resource.ResourceType, int> statistics = new Dictionary<Resource.ResourceType, int>();
public static GameManager Instance;
[SerializeField]private float money, citizens, wood, stone, metal;
[SerializeField]private float money, population, wood, stone, metal;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Awake()
{
Instance = this;
CalculatePopulation();
}
void Start()
{
}
// Update is called once per frame
void Update()
@@ -37,8 +38,8 @@ public class GameManager : MonoBehaviour
case Resource.ResourceType.Money:
money += amountToAdd;
break;
case Resource.ResourceType.Citizens:
citizens += amountToAdd;
case Resource.ResourceType.Population:
population += amountToAdd;
break;
}
}
@@ -54,9 +55,19 @@ public class GameManager : MonoBehaviour
return metal;
case Resource.ResourceType.Money:
return money;
case Resource.ResourceType.Citizens:
return citizens;
case Resource.ResourceType.Population:
return population;
}
return 0;
}
public void CalculatePopulation()
{
NPC[] npcs = FindObjectsByType<NPC>(FindObjectsSortMode.None);
AddResource(Resource.ResourceType.Population, npcs.Length);
}
public Building[] CountBuildings()
{
Building[] buildings = FindObjectsByType<Building>(FindObjectsSortMode.None);
return buildings;
}
}