public void OnRefugeePopulate() { if (People + Sick >= 50) { return; } int newPeopleMin = 5; int newPeopleMax = 25; if (bonus.Value != 0) { newPeopleMin = 10; newPeopleMax = 45; } if (TurnManager.Instance.EasyMode) { newPeopleMin += 10; newPeopleMax += 5; } newPeopleMin = Mathf.Min(newPeopleMin, MaxPeople - People - Sick); newPeopleMax = Mathf.Min(newPeopleMax, MaxPeople - People - Sick); var camps = FindObjectsOfType <RefugeeCamp>(); if (camps.Length != 0 && Sick == 0) { var camp = RandomHelper.Element(camps); (camp.Refugees, People) = RandomHelper.Move(camp.Refugees, People, newPeopleMin, newPeopleMax); } }
public void OnCreateRefugeeCamps() { var availableCells = bm.GetAvailableCellsForRefugees(); while (rm.RefugeesOnThisDay > 0 && availableCells.Count > 0) { var cells = availableCells.Values.ToList(); var cell = RandomHelper.Element(cells); bm.Build <RefugeeCamp>(cell); } }
public void OnRaids() { if (TurnManager.Instance.EasyMode && Random.Range(0, 100) < 50) { return; } var buildings = FindObjectsOfType <Building>().Where(b => b.IsReady()).ToList(); if (buildings.Count > 0) { ++RandomHelper.Element(buildings).DaysBroken; } }
public void OnHelpBuild() { const int chance = 66; if (Random.Range(0, 100) < chance) { return; } var buildings = FindObjectsOfType <Building>().Where(b => !b.IsReady()).ToList(); if (buildings.Count != 0) { --RandomHelper.Element(buildings).DaysLeft; } }
public void OnHeal() { int newSickMin = 5; int newSickMax = 25; if (bonus.Value != 0) { newSickMin = 10; newSickMax = 45; } var houses = FindObjectsOfType <House>().Where(h => h.Sick > 0).ToList(); if (houses.Count != 0) { var house = RandomHelper.Element(houses); (house.Sick, house.People) = RandomHelper.Move(house.Sick, house.People, newSickMin, newSickMax); } }
public void OnCreateRaiderCamps() { if (rm.Day < 22) { return; } if (TurnManager.Instance.EasyMode && Random.Range(0, 100) < 50) { return; } if (bm.GetAvailableCellsForRefugees().Count > 0) { var cells = bm.GetAvailableCellsForRefugees().Values.ToList(); var cell = RandomHelper.Element(cells); bm.Build <RaiderCamp>(cell); } }