/* * Function will be called after a player arrives to his destination. * Set this player's PlayerMovement to disabled, and as described in the usage section * of that script. */ private void OnPlayerArrived(EventInfo eventInfo) { AbstractTile currentTile = currentPlayer.GetCurrentTile(); // convert tile to interface, to use each tile's type's specific functions ITile currentTileInterface = currentTile as ITile; currentPlayer.playerMovement.enabled = false; if (!currentTile.tileHasOwner()) { // prompt player to pay if (currentTile.GetTILE_TYPE() != TILE_TYPE.EMPTY) { currentTileInterface.prompyBuyLocation(); GUImanager.EnableButton(BUTTON_TYPE.BUY); } } else { if (currentTile.tileHasItem()) { currentTile.buyItem(currentPlayer); } // if tile has an item, player is forced to buy item if he has enough money // GUImanager.promptTileBuy(currentPlayer.GetCurrentTile().getTileCard()); } GUImanager.EnableButton(BUTTON_TYPE.END_TURN); }
public void enableInitialGUIandStart() { GUImanager.EnableButton(BUTTON_TYPE.END_TURN); GUImanager.EnableButton(BUTTON_TYPE.THROW_DICE); GUImanager.setPlayerListGUI(true); for (int i = 0; i < GameInfo.playersNo; i++) { players[i].calculateIncome(); } startTurn(); }
/* * called by a button for player */ public void endTurn() { // current player will become next player // dice will be enabled GUImanager.disableGlowofPlayer(currentPlayerIndex); GUImanager.DisableButton(BUTTON_TYPE.BUY); currentPlayerIndex += 1; currentPlayerIndex %= (short)players.Length; currentPlayer = players[currentPlayerIndex]; DiceManager.resetDices(); GUImanager.EnableButton(BUTTON_TYPE.THROW_DICE); GUImanager.removeImage(); // temprory startTurn(); // Also, throw button should be enabled, and made interacable }
/* * called by manager */ public void startTurn() { // allow the current player to throw a dice, or do any possible action at this time // ex. trade, mortgage, charity, etc. // STATUS: WAITING FOR DICE THROW GUImanager.enableGlowofPlayer(currentPlayerIndex); GUImanager.DisableButton(BUTTON_TYPE.END_TURN); GUImanager.EnableButton(BUTTON_TYPE.THROW_DICE); // after Dice throw: // STATUS: AFTER DICE THROW // here, disable dice throw, unless double // events should be fired. Buy land, pull card, etc. // also, all options before the hrow should be open. // enable the button to end the turn }