Started working on Builder job and building buildings
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user