Ejemplo n.º 1
0
    // claims the land once called - removes defender and places attacker
    // NOTE: do not change order of commands below
    public void ClaimLand(GameObject attackingCountry, GameObject defendingCountry)
    {
        victoryCry.Play();
        controlTaken = true;
        defendingCountry.gameObject.tag = "SelectedCountry";
        addSoldier = defendingCountry.GetComponent <AddSoldier> ();

        // Adds a new soldier to defending country (attacker colour)
        addSoldier.PlaceSoldier();
        // causes a troop to be added to defender and removed from attacker in UpdateTroopCounter;
        countryManagement.ChangeArmySize(defendingCountry, 1);
        // Removes a soldier from attacker (moved to defender land - now claimed)
        armyManagement.RemoveDead("AttackingCountry", 1);
        // default transfers all attackers over to claimed land
        soldierTransfer.DefaultTransfer(attackingCountry, defendingCountry);
        // update the number of territories dictionary
        territoryCount.UpdateTerritoryBank(attackingCountry, defendingCountry);
        // update continent bonus
        continentBonus.UpdateContBonus();

        // set button colours
        buttonColour.BattleBattleColour(attackingCountry, defendingCountry);
        buttonColour.BattleAttackColour(false);
        buttonColour.BattlePlusMinusColour(false);

        // update instructions
        gameInstructions.BattleClaim(defendingCountry);
    }
Ejemplo n.º 2
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;
    }