Example #1
0
    //Print error
    public void FortifyError()
    {
        FortifyPanel fortify = fortifyPhasePanel.GetComponent <FortifyPanel>();

        fortify.description.text = "ERROR: Choose two different territories!!!";

        print("ERROR: Choose two different territories!!!");
    }
Example #2
0
    //Show fortify interface
    public void ShowFortifyPhasePanel()
    {
        FortifyPanel fortify = fortifyPhasePanel.GetComponent <FortifyPanel>();

        fortifyPhasePanel.SetActive(true);

        fortify.description.text = "Choose two territories to fortify";

        print("Fortify Phase Panel Active");
    }
Example #3
0
    private void Update()
    {
        //info of fortify stage slider
        if (fortifySliderParent.activeInHierarchy)
        {
            FortifyPanel fort = fortifyPhasePanel.GetComponent <FortifyPanel>();

            fortify_amount = Mathf.RoundToInt(fortifySlider.value);

            fort.minValue.text   = fortifySlider.minValue.ToString();
            fort.maxValue.text   = fortifySlider.maxValue.ToString();
            fort.curramount.text = fortify_amount.ToString();
        }

        //info of attack stage slider
        if (attackSliderParent.activeInHierarchy)
        {
            AttackPhasePanel attack = attackPhasePanel.GetComponent <AttackPhasePanel>();

            attack_amount = Mathf.RoundToInt(attackSlider.value);

            attack.minValue.text   = attackSlider.minValue.ToString();
            attack.maxValue.text   = attackSlider.maxValue.ToString();
            attack.curramount.text = attack_amount.ToString();
        }

        //if a battle has just finished
        if (GameManager.instance.battleHasEnded)
        {
            CountryHandler count = GameObject.Find(GameManager.instance.attackedTerritory)
                                   .GetComponent <CountryHandler>();

            if (count.country.battalions <= 0)
            {
                //Change race of Territory
                print(GameManager.instance.CURRENTRACE + " has taken control of " + count.country.name);
                count.country.race = GameManager.instance.CURRENTRACE;

                //Add the territories exp reward to players total
                print(count.country.expReward + " exp has been rewarded");
                GameManager.instance.exp += count.country.expReward;
                scoreManager.ChangeScore(GameManager.instance.CURRENTRACE, "exp", count.country.expReward);

                //Add the territories money reward to the players total
                print(count.country.moneyReward + " money has been rewarded");
                GameManager.instance.money += count.country.moneyReward;
                scoreManager.ChangeScore(GameManager.instance.CURRENTRACE, "money", count.country.moneyReward);

                //Set the number of battalions in the territory
                count.country.battalions = 0;

                //Increment level
                if (GameManager.instance.exp >= 500)
                {
                    GameManager.instance.level = GameManager.instance.level + 1;
                    scoreManager.SetScore(GameManager.instance.CURRENTRACE, "level", GameManager.instance.level);

                    //Reset exp to 0
                    GameManager.instance.exp = 0;
                    scoreManager.SetScore(GameManager.instance.CURRENTRACE, "exp", 0);

                    print(GameManager.instance.CURRENTRACE + " has leveled up to " + GameManager.instance.level);
                }

                //update dictionary
                scoreManager.ChangeScore(count.country.race, "territory", -1);
                scoreManager.ChangeScore(GameManager.instance.CURRENTRACE, "territory", 1);

                //ResetRewards();

                TintTerritories();

                ShowGUI(GameManager.instance.CURRENTRACE, GameManager.instance.money, GameManager.instance.exp, GameManager.instance.level);

                CheckIfGameWon();

                AttackMoveBattalions();
            }

            GameManager.instance.battleHasEnded = false;
        }
    }