Example #1
0
    // BATTLE! - calculates remaining troops
    void Battle(int attackers, int defenders)
    {
        if (!battleSound.isPlaying)
        {
            //battleSound.Play ();
            battleSound.time = Random.Range(0f, battleSound.clip.length);
            battleSound.Play();
            StartCoroutine(audioFadeOut.FadeOut(battleSound, 3f));
        }
        // attackers must leave 1 man behind
        attackers = attackers - 1;
        diceRoll.CalculateBattle(attackers, defenders, out deadAttackers, out deadDefenders);

        armyManagement.RemoveDead("AttackingCountry", deadAttackers);
        armyManagement.RemoveDead("DefendingCountry", deadDefenders);

        targetCountry.selectingDefender = false;
    }