Esempio n. 1
0
 // moves troops from attacking country to claimed country (----- + button -----)
 public void FwdTransferTroops()
 {
     // only run code on battle phase
     if (phases.battlePhase)
     {
         // play audio
         audioFadeOut.MoreTroopsAudio();
         // lock in current selections
         fromCountry = attack.attackingCountry;
         toCountry   = attack.defendingCountry;
         // error prevention
         if (fromCountry != null)
         {
             // must leave 1 man behind
             if (countryManagement.GetArmySize(fromCountry.name) > 1)
             {
                 armyMovement.MoveSoldier(fromCountry, toCountry);
             }
             buttonColour.BattlePlusMinusColour2(fromCountry, toCountry, 0);
         }
     }
 }
Esempio n. 2
0
    //TODO: move all troops to a country then pressing minus move them all back, once back to the original position the + button becomes unactive grey and locked.

    // Add a soldier to the selected country - setup phase only
    public void Add()
    {
        if (phases.setupPhase)
        {
            audioFadeOut.MoreTroopsAudio();
            country = GameObject.FindGameObjectWithTag("SelectedCountry");
            if (teamChecker.UnderControl(country) & deploySoldiers.CanAddSoldier())
            {
                addSoldier = country.GetComponent <AddSoldier> ();
                addSoldier.PlaceSoldier();
                UpdateNumbers(country, 1);
            }
            buttonColour.SetupPlusMinusColour();
        }
    }
Esempio n. 3
0
    //Remove presvious country selected and add tag to new country selection
    void OnMouseDown()
    {
        audioFadeOut.Click();
        //TODO: adjust this to take the number human players into account
        // cannot select countries during AI turn
        if (playerTurn.CurrentPlayer() != 1)
        {
            return;
        }

        // removes tag from previously selected country
        previousCountry = GameObject.FindGameObjectWithTag("SelectedCountry");
        if (previousCountry != null)
        {
            previousCountry.gameObject.tag = "Untagged";
        }

        // updates the current country selection
        country = gameObject.transform.parent.gameObject;
        country.gameObject.tag = "SelectedCountry";

        // activates and deactivates button colours
        buttonColour.SetupPlusMinusColour();
        if (phases.battlePhase)
        {
            buttonColour.BattleAttackColour(targetCountry.selectingDefender);
        }

        // sets the target as "defender" rather than "selectedCountry" when target country to attack
        if (targetCountry.selectingDefender)
        {
            targetCountry.SetDefender();
            return;
        }

        // movement phase mechanics
        if (phases.movementPhase)
        {
            buttonColour.MovementSelectFromCountry(country);
            // selects countries to move troops between
            if (armyMovement.movementSelected)
            {
                armyMovement.MovementCountries(country);
            }
        }

        // doesnt display selected territory during movement phase (other display is shown)
        if (armyMovement.movementSelected)
        {
            return;
        }

        // place soldiers during the opening phase script
        if (phases.openingPhase & teamChecker.UnderControl(country))
        {
            allocateSoldiers.DropSoldier(country);
            audioFadeOut.MoreTroopsAudio();
        }

        // Runs display selected country, doesnt run when selecting attacker or defender
        displayEditor.SelectedTerritory(country);
    }