public void GatherIncome() { string debug = "PLAYER " + playerID + " WAS : " + wallet; //Debug.Log("Size of player's Resourcebuildings when collecting: " + ResourceBuildings.Count); foreach (ResourceBuilding building in ResourceBuildings) { //Debug.Log("Gathering resources from ResourceBuilding: " + building); wallet = building.Earnings.adjustResources(wallet); // TODO: EVERYONE GETS EVERYONES RESOURCES... MAYBE JUST GIVE IT TO THE PLAYER WHO OWNS THE MINE? } foreach (Castle c in castle) { foreach (TownView.Building building in c.Town.Buildings) { if (building.GetType().BaseType == typeof(TownView.ResourceBuilding)) { TownView.ResourceBuilding b = (TownView.ResourceBuilding)building; wallet = b.Earnings.adjustResources(wallet); //Debug.Log("Gathering resources from TownBuilding " + b); } } } debug += "; IS : " + wallet; //Debug.Log(debug); }
/// <summary> /// Gets the income of the player /// </summary> /// <returns>The resource object with all his income</returns> public Resources GetIncome() { Resources resources = new Resources(); for (int i = 0; i < Resources.TYPES; i++) { // Gets income of buildings foreach (ResourceBuilding building in ResourceBuildings) { resources.adjustResource(i, building.Earnings.GetResource(i)); } // Gets income of castle buildings foreach (Castle c in Castle) { foreach (Building building in c.Town.Buildings) { if (building.GetType().BaseType == typeof(TownView.ResourceBuilding)) { TownView.ResourceBuilding b = (TownView.ResourceBuilding)building; resources.adjustResource(i, b.Earnings.GetResource(i)); } } } } return(resources); }