Exemplo n.º 1
0
    //menu country
    void countryMenu(country currentPlace, playerToken currentPlayer)
    {
        //buy

        if (currentPlace.Owned == false && currentPlayer.money >= currentPlace.price)
        {
            //Debug.Log("test3");
            if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .2f, Screen.width * .2f, Screen.height * .1f), "BUY"))
            {
                currentPlace.upgradeFlag = false;
                currentPlace.Buy(currentPlayer);
                VariableManager.turn = 2;
            }
        }
        //upgrade
        if (currentPlace.upgradeFlag == true &&
            currentPlace.Owned == true &&
            currentPlace.pOwning.name == currentPlayer.name &&
            currentPlace.Level < currentPlace.MaxLevel &&
            currentPlayer.money >= currentPlace.upgradePrice)
        {
            if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .3f, Screen.width * .2f, Screen.height * .1f), "UPGRADE"))
            {
                currentPlace.Upgrade(currentPlayer);

                /*currentPlayer.money -= currentPlace.upgradePrice;
                 * currentPlace.Level++;*/

                VariableManager.turn = 2;
            }
        }
        //sell
        if (currentPlayer.places.Count > 0)
        {
            if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .4f, Screen.width * .2f, Screen.height * .1f), "SELL"))
            {
                this.yourArray       = new List <bool>(currentPlayer.places.Count);
                this.offSet          = 0;
                VariableManager.turn = 5;
            }
        }
        //surrender
        if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .5f, Screen.width * .2f, Screen.height * .1f), "SURRENDER"))
        {
            currentPlayer.surrender();

            /*foreach(place pl in currentPlayer.places){
             *      if(pl.GetType() == typeof(country)){
             *              //pl = (country)pl;
             *              country temp = GameObject.Find(pl.name);
             *              temp.Owned = false;
             *      }
             * }*/
        }
        //end turn
        if (VariableManager.turn == 2)
        {
            if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .6f, Screen.width * .2f, Screen.height * .1f), "END TURN"))
            {
                currentPlace.upgradeFlag = true;
                VariableManager.state++;
                if (VariableManager.state == VariableManager.jumlahPlayer)
                {
                    VariableManager.state = 0;
                }
                VariableManager.turn = 0;
                //Debug.Log(VariableManager.turn + " " + VariableManager.state);
            }
        }
    }