/// <summary> /// Kill a number of evil people in a country. /// </summary> /// <param name="numberToKill"> The number of people to be killed.</param> /// <param name="country"> The country in which the killing is to take place.</param> private void KillEvilPeople(long numberToKill, Region_Controller country) { if (numberToKill < country.evilPop) { country.evilPop -= numberToKill; country.population -= numberToKill; country.evilDiedToday += numberToKill; } else { long numberKilled = country.evilPop; country.evilPop = 0; country.population -= numberKilled; country.evilDiedToday += numberToKill; } }
/// <summary> /// Kill a number of neutral people in a country. /// </summary> /// <param name="numberToKill"> The number of people to be killed.</param> /// <param name="country"> The country in which the killing is to take place.</param> private void KillNeutralPeople(long numberToKill, Region_Controller country) { if (numberToKill < country.neutralPop) { country.neutralPop -= numberToKill; country.population -= numberToKill; // No need for neutralDiedToday since it doesn't have effect on any resources. } else { // long numberKilled = country.neutralPop; country.neutralPop = 0; country.population -= numberKilled; } }
/// <summary> /// Kill a number of good people in a country. /// </summary> /// <param name="numberToKill"> THe number of people to be killed.</param> /// <param name="country">The country in which the killing will take place.</param> private void KillGoodPeople(long numberToKill, Region_Controller country) { if (numberToKill < country.goodPop) { country.goodPop -= numberToKill; country.population -= numberToKill; country.goodDiedToday += numberToKill; } else { // The number to be killed is higher than the number of same aligned people in the country. long numberKilled = country.goodPop; country.goodPop = 0; country.population -= numberKilled; country.goodDiedToday += numberKilled; } }
/// <summary> /// Calls methods to kill people of a given alignment. /// </summary> /// <param name="alignment"> The alignment of the population to be killed.</param> /// <param name="numberToKill"> The number of people to be killed.</param> /// <param name="country"> The country in which the people will be killed.</param> private void KillPeople(Alignment alignment, long numberToKill, Region_Controller country) { if (numberToKill < 0) { throw new System.ArgumentException("The number of people to be killed is less than zero."); } // Calls the methods to kill a certain alignment of people. if (alignment == Alignment.good) { KillGoodPeople(numberToKill, country); } else if (alignment == Alignment.neutral) { KillNeutralPeople(numberToKill, country); } else if (alignment == Alignment.evil) { KillEvilPeople(numberToKill, country); } }
/// <summary> /// Kills a bunch of good people in a given country. Appropriately configures and displays event panel. /// </summary> /// <param name="country">The country object of region_controller.</param> /// <param name="countryName">The string name of the country.</param> public void MurderousCult(Region_Controller country, string countryName) { //should probably these a method for use in more events .. CallFunction(float range from, float range to, country) float killGoodNumberF = Random.Range(1.0f, 10000.0f); long killGoodNumber = (long)killGoodNumberF; if (killGoodNumber > country.goodPop) { killGoodNumber = country.goodPop; } country.goodPop -= killGoodNumber; country.population -= killGoodNumber; country.goodDiedToday = killGoodNumber; //set event panel SetEventsPanelActive(); //configure events text (should maybe come before activating eventsDescr = $"An evil murderous cult has appeared in {countryName}! {killGoodNumber} good people have been massacred!"; eventsContentText.text = eventsDescr; }
/// <summary> /// Kills a random amount of people in a specified country. configures and activates events panel. /// </summary> /// <param name="country">The country object of region_controller.</param> /// <param name="countryObj">The string name of the country.</param> public void RandomWar(Region_Controller country, string countryObj) { float killNeutralNumberF = Random.Range(100.0f, 100000.0f); long killNeutralNumber = (long)killNeutralNumberF; float killEvilNumberF = Random.Range(100f, 100000.0f); long killEvilNumber = (long)killEvilNumberF; float killGoodNumberF = Random.Range(100f, 100000.0f); long killGoodNumber = (long)killGoodNumberF; KillPeople(Alignment.good, killGoodNumber, country); KillPeople(Alignment.neutral, killNeutralNumber, country); KillPeople(Alignment.evil, killEvilNumber, country); //set event panel SetEventsPanelActive(); eventsDescr = $"A war has broken out in {countryObj}. {killEvilNumber} evil people, {killGoodNumber} good people and {killNeutralNumber} neutral people have died in the fighting!"; eventsContentText.text = eventsDescr; PrintCountryDeath(country.gameObject.transform.position, killEvilNumber, killNeutralNumber, killGoodNumber); }