Exemplo n.º 1
0
    // Randomly places a soldier on a players allocated piece of land
    void SetBoard()
    {
        // Loops through each country adding a soldier at the COM
        foreach (Transform continent in this.transform)
        {
            foreach (Transform country in continent.transform)
            {
                //Instantiate at countries COM soldier at the stored placer location
                addSoldier             = country.GetComponent <AddSoldier>();
                clone                  = Instantiate(Resources.Load("Soldier"), addSoldier.findCOM(country), Quaternion.identity) as GameObject;
                clone.transform.parent = country.transform;

                // make the soldiers random colours
                randomPlayerNum = RandomPlayer();
                soldierManagement.SetSoldierColour(clone, randomPlayerNum);
                countryManagement.ChangeArmySize(country.gameObject, 1);
            }
        }
        // selects Alaska as the default selected country - prevent +button at the start error
        GameObject defaultCountry = GameObject.Find("Alaska");

        defaultCountry.gameObject.tag = "SelectedCountry";
        // start opening phase
        phases.startingPhase = false;
        phases.openingPhase  = true;
    }
Exemplo n.º 2
0
    // Places a soldier at the country's adjusted COM
    public void PlaceSoldier()
    {
        soldierPosition = new Vector3(0, 0, 0);
        soldierPosition = PositionAdjustment(findCOM(this.transform));

        // Instantiates a soldier at the stored placer location
        clone = Instantiate(Resources.Load("Soldier"), soldierPosition, Quaternion.identity) as GameObject;
        clone.transform.parent = this.transform;
        if (phases.setupPhase)
        {
            clone.gameObject.tag = "DeployedSoldier";
        }
        // requires player index as unput, hence the -1
        soldierManagement.SetSoldierColour(clone, playerTurn.CurrentPlayer() - 1);
        // update game stats
        troopCount.UpdateTroopBankV2(playerTurn.CurrentPlayer(), 1);
    }