Пример #1
0
    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);
        }
    }
Пример #2
0
 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);
     }
 }
Пример #3
0
    public void MakePeace()
    {
        Country         playerCountry   = CountryManager.instance.PlayerCountry;
        CountryRelation countryRelation = CountryManager.instance.GetRelationBetweenCountries(playerCountry, currentCountry);

        countryRelation.MakePeace();

        RefreshAll();
        AudioManager.instance.ClickButton();
    }
Пример #4
0
    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();
        }
    }
Пример #5
0
    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);
    }
Пример #6
0
    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;
        }
    }