public bool verifyPayment(float price) { // Why double/triple/quadruple/{x} charge them? if (currPlayer.paidMoneyProp) { return(false); } // Verify player hath enough money if (currPlayer.enouoghmoney(Tiles[currPlayer.getTileIndex()].Rent)) { return(true); // If they don't, show the ending screen } else { // Make winScreen visible GameObject winScreen = FindChildInParent.findChild(GameObject.Find("Canvas"), "GameStatus"); winScreen.SetActive(true); // Current player is "dead", switch to next player, nextTurn(); FindChildInParent.findChild(winScreen, "Winner Text").GetComponent <Text>().text = currPlayer.name; Destroy(currPlayer.gameObject); return(false); } }
// This sets up first values for player public void startBidScreen() { Tile currentTile = g.getCurrTile(); // Doth the tile belong to someone? If so, return. (We can't bid on pre-owned property, that's just silly) if (currentTile.Owner != null) { return; } // Make bidding ui visible (how else are they sipposed to interact with the buttons?) bidUi.SetActive(true); // Make Screen2 invisible. reusable = FindChildInParent.findChild(bidUi.transform, "Second Screen"); reusable.SetActive(false); reusable = null; }
public void bidCommence() { // Get base price GameObject price = GameObject.Find("PriceSelector"); // Find the GameObject named "Text" in the price selector string rawBidText = FindChildInParent.findChild(price.transform, "Text").GetComponent <Text>().text; float result; float.TryParse(rawBidText, out result); print((result == 0) ? "we got a smart aleck over 'ere bill. I think its time we teach 'em a li'l' lesson." : null); result = (result == 0) ? g.getCurrPlayer().getMoney() * 2 : result; // Make Screen1 invisible. reusable = FindChildInParent.findChild(bidUi, "First Screen"); reusable.SetActive(false); // Make Screen2 visible. reusable = FindChildInParent.findChild(bidUi, "Second Screen"); reusable.SetActive(true); GameObject player1 = FindChildInParent.findChild(reusable.transform, "Player1"); GameObject player2 = FindChildInParent.findChild(reusable.transform, "Player2"); //Set Left-most text to be current player //Setting title for current player reusable = FindChildInParent.findChild(player1, "Player 1 Text"); reusable.GetComponent <Text>().text = g.getCurrPlayer().name; //Setting current player bid price reusable = FindChildInParent.findChild(player1, "Player 1 bidText"); reusable.GetComponent <Text>().text = "Bid: $" + result.ToString(); //Set Right-most text to opposite player reusable = FindChildInParent.findChild(player2, "Player 2 Text"); reusable.GetComponent <Text>().text = (g.getCurrPlayer().name == "Player1") ? "Player2" : "Player1"; //Setting current player bid price reusable = FindChildInParent.findChild(player2, "Player 2 bidText"); reusable.GetComponent <Text>().text = "Bid: $" + 0; reusable = null; }