Example #1
0
    //check chest
    bool chestMenu(chest currentPlace, playerToken currentPlayer)
    {
        //pay or gain
        int tempNum = currentPlace.RentPrice();

        if (tempNum < 0)
        {
            //PAY
            if (currentPlayer.money > (tempNum * -1))
            {
                desc = "PAY " + tempNum;
                if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .1f, Screen.width * .3f, Screen.height * .1f), "PAY"))
                {
                    VariableManager.tax -= tempNum;
                    currentPlayer.money += tempNum;
                    return(true);

                    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();
                VariableManager.turn = 0;
            }
        }
        else
        {
            //GAIN
            currentPlayer.money += tempNum;
            desc = "GAIN " + tempNum;
            VariableManager.turn = 2;
            return(true);
        }
        return(false);
        //end turn
    }
Example #2
0
    //menu airport
    void airportMenu(airport currentPlace, playerToken currentPlayer)
    {
        //buy
        if (currentPlace.Owned == false && currentPlayer.money >= currentPlace.price)
        {
            if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .2f, Screen.width * .2f, Screen.height * .1f), "BUY"))
            {
                currentPlace.Buy(currentPlayer);
                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();
        }
        //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"))
            {
                VariableManager.state++;
                if (VariableManager.state == VariableManager.jumlahPlayer)
                {
                    VariableManager.state = 0;
                }
                VariableManager.turn = 0;
            }
        }
    }
Example #3
0
 //pay check
 bool countryPayCheck(country currentPlace, playerToken currentPlayer)
 {
     if (currentPlace.Owned == false)
     {
         return(true);
     }
     else
     {
         //pay
         if (currentPlayer.money > currentPlace.RentPrice())
         {
             desc = "PAY " + currentPlace.RentPrice();
             if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .1f, Screen.width * .3f, Screen.height * .1f), "PAY"))
             {
                 currentPlace.Pay(currentPlayer);
                 VariableManager.turn = 2;
             }
         }
         //sell
         if (currentPlayer.places.Count > 0)
         {
             if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .4f, Screen.width * .3f, Screen.height * .1f), "SELL"))
             {
                 this.yourArray       = new List <bool>(currentPlayer.places.Count);
                 this.offSet          = 0;
                 VariableManager.turn = 5;
             }
         }
         //surrender
         if (currentPlayer.money < currentPlace.RentPrice())
         {
             if (GUI.Button(new Rect(Screen.width * .03f, Screen.height * .5f, Screen.width * .2f, Screen.height * .1f), "SURRENDER"))
             {
                 currentPlayer.surrender();
             }
         }
     }
     return(false);
 }
Example #4
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);
            }
        }
    }