void RefreshButtons() { Country playerCountry = CountryManager.instance.PlayerCountry; CountryRelation countryRelation = CountryManager.instance.GetRelationBetweenCountries(playerCountry, currentCountry); float relationAmount = countryRelation.GetAmount(); if (relationAmount >= 0) { makePeaceButton.gameObject.SetActive(false); makeWarButton.gameObject.SetActive(true); } else { if (relationAmount >= -10) { makePeaceButton.gameObject.SetActive(true); } else { makePeaceButton.gameObject.SetActive(false); } makeWarButton.gameObject.SetActive(false); } }
public override void ChangeRelationsAfterBattle(Country attackerCountry) { if (!attackerCountry.isDefaultCountry) { Debug.Log("Changing relations because WorldAgent has been conquered"); CountryRelation countryRelation = CountryManager.instance.GetRelationBetweenCountries(MyCountry, attackerCountry); countryRelation.ChangeAmount(-5); } }
public void MakePeace() { Country playerCountry = CountryManager.instance.PlayerCountry; CountryRelation countryRelation = CountryManager.instance.GetRelationBetweenCountries(playerCountry, currentCountry); countryRelation.MakePeace(); RefreshAll(); AudioManager.instance.ClickButton(); }
public void PayForBetterRelations() { const int payAmount = 100; const int changeRelationAmount = 10; Country playerCountry = CountryManager.instance.PlayerCountry; Item item = new Item(ItemType.Gold, payAmount); if (playerCountry.CanTradeItem(item)) { CountryRelation countryRelation = CountryManager.instance.GetRelationBetweenCountries(playerCountry, currentCountry); countryRelation.ChangeAmount(changeRelationAmount); playerCountry.Inventory.MoveItemToInventory(item, currentCountry.Inventory); RefreshAll(); AudioManager.instance.ClickButton(); } }
public List <WorldAgent> GetEnemyWorldAgentsForCountry(Country country) { List <WorldAgent> result = new List <WorldAgent>(); foreach (WorldAgent currWorldAgent in worldAgents) { if (currWorldAgent.MyCountry == country) { continue; } CountryRelation currCountryRelation = CountryManager.instance.GetRelationBetweenCountries(country, currWorldAgent.MyCountry); if (currCountryRelation.IsEnemy()) { result.Add(currWorldAgent); } } return(result); }
void RefreshRelationBar() { Country playerCountry = CountryManager.instance.PlayerCountry; CountryRelation countryRelation = CountryManager.instance.GetRelationBetweenCountries(playerCountry, currentCountry); float amount = countryRelation.GetAmount(); //Fill UI realtions bar if (amount > 0) { goodProgressImg.fillAmount = amount / CountryRelation.maxAmount; badProgressImg.fillAmount = 0; } else if (amount < 0) { goodProgressImg.fillAmount = 0; badProgressImg.fillAmount = amount / CountryRelation.minAmount; } else { goodProgressImg.fillAmount = 0; badProgressImg.fillAmount = 0; } }