コード例 #1
0
 public PlayerWallet getWallet(PlayMoving p)
 {
     if (p == Shoe)
     {
         //	consoleText = "getting shoe wallet...";
         return(ShoeWallet);
     }
     else if (p == Thimble)
     {
         //	consoleText = "getting thimble wallet...";
         return(ThimbleWallet);
     }
     else if (p == TopHat)
     {
         //	consoleText = "getting tophat wallet...";
         return(TopHatWallet);
     }
     else if (p == Battleship)
     {
         //	consoleText = "getting battleship wallet...";
         return(BattleshipWallet);
     }
     else
     {
         consoleText = "error, wallet not found";
         return(null);
     }
 }
コード例 #2
0
    private void updatePlayOrder()
    {
        var thisPlayer = new PlayMoving();
        var tempText   = "";

        for (int i = 0; i < PlayerList.Count; i++)
        {
            thisPlayer = (PlayMoving)PlayerList[i];
            tempText  += thisPlayer.getName() + " ";
        }
        PlayOrder.text = tempText;
    }
コード例 #3
0
    public override void OnPress(bool isPressed)
    {
        if (isEnabled)
        {
            base.OnPress(isPressed);
        }
//		Shoe.is_Moving = true;
        if (Input.GetMouseButtonUp(0))
        {
            currPlayer = monopolyGame.GetCurrPlayer();
            playerMove(currPlayer);              //execute currentPlayer's move
            monopolyGame.advPlayerOrder();
        }
    }
コード例 #4
0
    public string richestPlayer(ArrayList listOfPlayers)
    {
        var highMoney  = 0;
        var highPlayer = new PlayMoving();
        var tempPlayer = new PlayMoving();

        for (int i = 0; i < listOfPlayers.Count; i++)
        {
            tempPlayer = (PlayMoving)listOfPlayers[i];
            print("looking at: " + tempPlayer.getName());
            if (highMoney < monopolyGame.getWallet(tempPlayer).getWalletAmount())
            {
                highPlayer = tempPlayer;
                highMoney  = monopolyGame.getWallet(tempPlayer).getWalletAmount();
            }
        }
        monopolyGame.consoleText = "high score found!";
        CurrentWinner_Label.text = highPlayer.getName();
        return(highPlayer.getName());
    }
コード例 #5
0
    //private method to decide whether or not to buy the land
    private void buyLand_AI(PlayMoving newOwner)      ///@@#$!@$#!@$ Battleship is buying with TophatMoney
    //monopolyGame.consoleText = "new buyer is: "+ newOwner.getName ();
    {
        if (monopolyGame.getWallet(newOwner).getWalletAmount() >= (int)(monopolyGame.LocationLibrary.getLand(newOwner.currentSpaceNum) [2]))
        {
            //	monopolyGame.consoleText =  newOwner.getName()+" buying "+(string)monopolyGame.LocationLibrary.getLand(newOwner.currentSpaceNum)[0];
            monopolyGame.LocationLibrary.getLand(newOwner.currentSpaceNum).Add(monopolyGame.getWallet(newOwner));
            //^^needs to be validated

            //print (currPlayer.getName() + " is buying site for:" + monopolyGame.LocationLibrary.getLand (newOwner.currentSpaceNum) [2]);
            //monopolyGame.getWallet (newOwner).getWalletAmount ();
            monopolyGame.getWallet(newOwner).subtractMoney((int)monopolyGame.LocationLibrary.getLand(newOwner.currentSpaceNum) [2]);
            //>>____<<
            monopolyGame.getWallet(newOwner).addLand(monopolyGame.LocationLibrary.getLand(newOwner.currentSpaceNum));
            //^^^^this line needs validation still
            print("site bought! Player now has: " + monopolyGame.getWallet(newOwner).getWalletAmount());
        }
        else
        {
            monopolyGame.consoleText = "land not bought, insufficient funds";
        }
    }
コード例 #6
0
 IEnumerator ani()
 {
     if (ChanceNumber == 1)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 1);
         ChanceNumber = 0;
         monopolyGame.getWallet(actingPlayer).subtractMoney(15);
         monopolyGame.updateCV_money(15);
         monopolyGame.consoleText = actingPlayer.getName() + "paid $15 poor tax";
     }
     if (ChanceNumber == 2)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 2);
         ChanceNumber = 0;
         actingPlayer.forceNewLocation(0);
         monopolyGame.getWallet(actingPlayer).addMoney(200);
         monopolyGame.consoleText = actingPlayer.getName() + " adv. to GO with $200";
     }
     if (ChanceNumber == 3)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 3);
         ChanceNumber = 0;
         var nLoc = actingPlayer.currentSpaceNum - 3;
         if (nLoc < 0)
         {
             nLoc = 40 + nLoc;
         }
         actingPlayer.forceNewLocation(nLoc);
         monopolyGame.consoleText = actingPlayer.getName() + " went back 3 spaces";
     }
     if (ChanceNumber == 4)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 4);
         ChanceNumber = 0;
         var otherPlayer = new PlayMoving();
         for (int i = 1; i < monopolyGame.GetPlayerList().Count; i++)
         {
             otherPlayer = (PlayMoving)monopolyGame.GetPlayerList()[i];
             monopolyGame.getWallet(otherPlayer).addMoney(50);
             monopolyGame.getWallet(actingPlayer).subtractMoney(50);
         }
         monopolyGame.consoleText = actingPlayer.getName() + " became chairman, paid $50 to ea. player";
     }
     if (ChanceNumber == 5)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 5);
         ChanceNumber = 0;
         actingPlayer.forceNewLocation(40);
         monopolyGame.consoleText = actingPlayer.getName() + " is going to jail!";
     }
     if (ChanceNumber == 6)
     {
         chance_Animator.SetTrigger("refreshed");
         chance_Animator.SetInteger("pointer", 6);
         ChanceNumber = 0;
         monopolyGame.getWallet(actingPlayer).addMoney(150);
         monopolyGame.consoleText = actingPlayer.getName() + " building and loan matures, collect $150";
     }
     if (Input.GetKeyDown(KeyCode.Delete))
     {
         chance_Animator.SetTrigger("next");
         monopolyGame.consoleText = "debug, Chance_next pressed";
     }
     yield return(new WaitForEndOfFrame());
 }
コード例 #7
0
 // Update is called once per frame
 void Update()
 {
     aniSearch();
     actingPlayer = monopolyGame.GetCurrPlayer();
 }
コード例 #8
0
    // Use this for initialization

    void Start()
    {
        ChanceNumber = 0;
        actingPlayer = new PlayMoving();
    }
コード例 #9
0
ファイル: LibraryLib.cs プロジェクト: LuckyBYR/monopoly-1
    public void specialLandProcess(PlayMoving thePlayer, PlayerWallet theWallet, ArrayList spLand)
    {
        var tempCounter = 0;

        //railroads
        if (((int)spLand [1] == 5) || ((int)spLand [1] == 15) || ((int)spLand [1] == 25) || ((int)spLand [1] == 35))
        {
            var tempOwner = getOwner(spLand);              //checks if the railroad is owned
            if (tempOwner != null)
            {
                for (int i = 0; i < theWallet.myLandList.Count - 1; i++)
                {
                    var tempArr = (ArrayList)theWallet.myLandList [i];
                    if (tempArr [3].ToString() == "r")
                    {
                        tempCounter++;
                    }
                }
                getOwner(spLand).addMoney(tempCounter * 75);                  //probalby need to fix these lines for datastructures
                theWallet.subtractMoney(tempCounter * 75);
                print("railroad rent paid");
            }
            else if (theWallet.getWalletAmount() > 200)
            {
                monopolyGame.LocationLibrary.getLand(thePlayer.currentSpaceNum).Add(theWallet);
                theWallet.subtractMoney(200);
                print(thePlayer.getName() + "bought railroad");
            }
            else
            {
                print("player doesnt have enough money to buy railroad");
            }
        }

        //utility
        else if (((int)spLand [1] == 12) || ((int)spLand [1] == 28))
        {
            var tempOwner = getOwner(spLand);              //checks if the railroad is owned
            if (tempOwner != null)
            {
                for (int i = 0; i < theWallet.myLandList.Count - 1; i++)
                {
                    var tempArr = (ArrayList)theWallet.myLandList [i];
                    if (tempArr [3].ToString() == "u")
                    {
                        tempCounter++;
                    }
                }
                var number = Random.Range(2, 12);
                getOwner(spLand).addMoney(tempCounter * 4 * number);                  //probalby need to fix these lines for datastructures
                theWallet.subtractMoney(tempCounter * 4 * number);
                print("utilities paid");
            }
            else if (theWallet.getWalletAmount() > 150)
            {
                monopolyGame.LocationLibrary.getLand(thePlayer.currentSpaceNum).Add(theWallet);
                theWallet.subtractMoney(150);
                print(thePlayer.getName() + "bought utility");
            }
            else
            {
                print("player doesnt have enough money to buy utility");
            }
        }

        //income tax --addmoney to communityvault
        else if ((int)spLand [1] == 4)
        {
            var tempMoney = (int)(theWallet.getWalletAmount() * 0.15);
            theWallet.subtractMoney(tempMoney);
            monopolyGame.updateCV_money(tempMoney);
            print("taxes paid");
            monopolyGame.consoleText = thePlayer.getName() + " has paid taxes!";
        }

        //luxury tax
        else if ((int)spLand [1] == 38)
        {
            theWallet.subtractMoney(75);
            print("luxury tax paid");
        }

        //community chest
        else if (((int)spLand [1] == 2) || ((int)spLand [1] == 17) || ((int)spLand [1] == 33))
        {
            CCdeck.CCnumber = Random.Range(1, 7);
        }

        //chance
        else if (((int)spLand [1] == 7) || ((int)spLand [1] == 22) || ((int)spLand [1] == 36))
        {
            chanceDeck.ChanceNumber = Random.Range(1, 7);
        }
        else if ((int)spLand [1] == 20)            //landed on free parking
        {
            theWallet.addMoney(monopolyGame.getCV_money());
            monopolyGame.updateCV_money(-monopolyGame.getCV_money());
            print("player cleared the community vault");
            monopolyGame.consoleText = "Community Vault has been emptied by: " + thePlayer.getName();
        }
        else if (((int)spLand [1] == 0))
        {
            monopolyGame.consoleText = thePlayer.getName() + " is on GO! ";
            thePlayer.passedGO       = true;
        }
        else
        {
            print("merp, nothing special");
            //monopolyGame.consoleText = "Not a special place";
        }
    }
コード例 #10
0
    //methods below are used to excute the Movement of a single Player.

    public void playerMove(PlayMoving myPlayer)
    {
        //make player roll dice
        var newDistance = stepsToTake();

        //generate random number, but also correspond to dice animation


        myPlayer.travelToNewLocation(newDistance);         //have player move to newlocation
        //^(imbeded within PlayMoving.cs)^check to see to see if player passed GO

        if (isGoingToJail())           //check to see if player is going to jail (various ways)
        {
            print("player is going to jail");
            myPlayer.forceNewLocation(40);
        }
        //monopolyGame.consoleText = "did not pass go";
        if (myPlayer.hasPassedGo())
        {
            //monopolyGame.consoleText = "has just passed GO! adding money...";
            monopolyGame.getWallet(myPlayer).getWalletAmount();
            monopolyGame.getWallet(myPlayer).addMoney(200);
            myPlayer.resetPassGo();
            print("money added. wallet: " + monopolyGame.getWallet(myPlayer).getWalletAmount());
        }

        var currentLand = (ArrayList)monopolyGame.LocationLibrary.getLand(myPlayer.currentSpaceNum);

        monopolyGame.consoleText = myPlayer.getName() + " traveling to : " + ((ArrayList)monopolyGame.LocationLibrary.getLand(myPlayer.targetSpaceNum))[0];
        if (monopolyGame.LocationLibrary.isSpecialLand(currentLand))
        {
            //	monopolyGame.consoleText =  "special land...";
            monopolyGame.LocationLibrary.specialLandProcess(myPlayer, monopolyGame.getWallet(myPlayer), monopolyGame.LocationLibrary.getLand(myPlayer.currentSpaceNum));
        }
        else if (hasBeenBought(currentLand))         //check to see if spot has been bought
        {
            var rentAmount = (int)monopolyGame.LocationLibrary.calculateRent(currentLand);
            //var landOwner = (PlayerWallet)monopolyGame.LocationLibrary.getOwner(currentLand);
            //var myPwallet = monopolyGame.getWallet(myPlayer);
            if (!(Object.Equals(monopolyGame.getWallet(myPlayer), monopolyGame.LocationLibrary.getOwner(currentLand))))
            {
                //rent paying still needs to be validated

                print("this amount being paid: " + rentAmount);
                monopolyGame.getWallet(myPlayer).subtractMoney(rentAmount);
                //myPwallet.subtractMoney(rentAmount);		//if bough, pay rent
                monopolyGame.LocationLibrary.getOwner(currentLand).addMoney(rentAmount);
                monopolyGame.consoleText = "rent paid";
            }
            else if (ReferenceEquals((PlayerWallet)monopolyGame.LocationLibrary.getOwner(currentLand), monopolyGame.getWallet(myPlayer)))            //checks to see if Owned land and builds house
            {
                print("attempting building house");
                //<<insert buildHouse function
                if (monopolyGame.LocationLibrary.buildHouse((ArrayList)monopolyGame.LocationLibrary.getLand(myPlayer.currentSpaceNum)))
                {
                    monopolyGame.getWallet(myPlayer).subtractMoney((int)currentLand[2]);
                }
            }
        }
        else
        {
            buyLand_AI(myPlayer);             //checks to see if theres enough money, buys if possible
        }
    }
コード例 #11
0
 void Update()
 {
     animateCC();
     currentPlayer = monopolyGame.GetCurrPlayer();
 }
コード例 #12
0
    // Use this for initialization

    void Start()
    {
        CCnumber      = 0;
        currentPlayer = new PlayMoving();
    }