PropertyTycoon
 
Loading...
Searching...
No Matches
Player Class Reference

Represents a playable game object throughout the game, which can either be a human player or a bot. More...

Inheritance diagram for Player:
Bot SmartBot

Public Member Functions

void StartTurn ()
 Starts the player's turn, setting them as the active player and updating the UI.
 
void ShiftTileIndex (int offset)
 Sets the newTileIndex depending on the offset from the currentTileIndex, e.g. offset of -3 sets newTileIndex back 3 spaces.
 
void SetNewTileIndex (int newTileIndex)
 Sets the new tile index for the player, ensuring it wraps around the board if necessary.
 
void CompleteTurn ()
 Called once tile functionality is complete and either ends the turn or allows for another turn, ensuring player has positive money.
 
virtual void ForSaleDecision (Property property)
 Shows for sale prompt to player or manually decides action if bot.
 
virtual void BidDecision ()
 Sets this player as the current bidder and gives player button choices.
 
void WinAuction (Property property, int price)
 Gives the player the property that was auctioned for the auction price and gives them the title deed card.
 
void GiveMoney (int amount)
 Gives the player a specified amount of money.
 
void TakeMoney (int amount)
 Takes a specified amount of money from the player.
 
void AddGetOutOfJailFreeCard (ActionCard actionCard)
 Adds a Get Out Of Jail Free card to the player's collection.
 
void TakeTitleDeed (Property property)
 
void SetSprite (Sprite sprite)
 Sets the sprite for the player game object.
 
int GetCurrentTileIndex ()
 Gets the current tile index of the player. This method is primarily used for unit testing to verify player position on the board and movement logic.
 

Public Attributes

int moveTest
 

Protected Member Functions

virtual void RollDiceDecision ()
 Shows prompt to payer or manually rolls if bot.
 
virtual void EndTurnDecision ()
 Shows prompts to player or manually decides action if bot.
 
void OnEndTurn ()
 Handles the player's turn ending and signaling the board to end the turn.
 
virtual void InJailDecision ()
 Shows prompt to player or manually decides action if bot.
 
void OnPostBail ()
 Player pays fine and leaves jail.
 
void OnGetOutOfJailFree ()
 Player returns get out of jail free card to board card pile and leaves jail.
 
void OnRemainInJail ()
 Handles the player's decision to remain in jail, hiding the jail prompt and ending the turn.
 
void OnBuy ()
 Buys the property that the player is currently on and gives the player the title deed card.
 
void OnAuction ()
 Auctions the property that the player is currently on.
 
void OnBid ()
 
void OnFold ()
 
virtual void RaiseFundsDecision ()
 Shows prompt to player or manually raises funds if bot.
 
List< PropertyGetMortgageableProperties ()
 
List< PropertyGetUnmortgageableProperties ()
 
List< PropertyGetSellableProperties ()
 
bool CanMortgage ()
 
bool CanSellProperty ()
 

Protected Attributes

List< ActionCardGetOutOfJailFreeCards
 

Static Protected Attributes

static Player CurrentBidder
 
const int PostBailAmount = 50
 

Properties

Sprite Sprite [get]
 
string Name [get, set]
 
int Money = 1500 [get]
 
Property[] TitleDeeds [get]
 
bool InJail [get]
 
int DiceRoll [get]
 
int Houses [get]
 
int Hotels [get]
 
bool PassedGo = true [get]
 

Detailed Description

Represents a playable game object throughout the game, which can either be a human player or a bot.

Member Function Documentation

◆ AddGetOutOfJailFreeCard()

void Player.AddGetOutOfJailFreeCard ( ActionCard actionCard)

Adds a Get Out Of Jail Free card to the player's collection.

Parameters
actionCardThe Get Out Of Jail Free card to add.

◆ BidDecision()

virtual void Player.BidDecision ( )
virtual

Sets this player as the current bidder and gives player button choices.

Reimplemented in Bot, and SmartBot.

◆ EndTurnDecision()

virtual void Player.EndTurnDecision ( )
protectedvirtual

Shows prompts to player or manually decides action if bot.

Reimplemented in Bot, and SmartBot.

◆ ForSaleDecision()

virtual void Player.ForSaleDecision ( Property property)
virtual

Shows for sale prompt to player or manually decides action if bot.

Parameters
propertyThe property the player landed on

Reimplemented in Bot, and SmartBot.

◆ GetCurrentTileIndex()

int Player.GetCurrentTileIndex ( )

Gets the current tile index of the player. This method is primarily used for unit testing to verify player position on the board and movement logic.

Returns
The index of the tile the player is currently on

◆ GiveMoney()

void Player.GiveMoney ( int amount)

Gives the player a specified amount of money.

Parameters
amountThe amount of money to give the player.

◆ InJailDecision()

virtual void Player.InJailDecision ( )
protectedvirtual

Shows prompt to player or manually decides action if bot.

Reimplemented in Bot, and SmartBot.

◆ RaiseFundsDecision()

virtual void Player.RaiseFundsDecision ( )
protectedvirtual

Shows prompt to player or manually raises funds if bot.

Reimplemented in Bot, and SmartBot.

◆ RollDiceDecision()

virtual void Player.RollDiceDecision ( )
protectedvirtual

Shows prompt to payer or manually rolls if bot.

Reimplemented in Bot, and SmartBot.

◆ SetNewTileIndex()

void Player.SetNewTileIndex ( int newTileIndex)

Sets the new tile index for the player, ensuring it wraps around the board if necessary.

Parameters
newTileIndexThe new tile index to set.

◆ SetSprite()

void Player.SetSprite ( Sprite sprite)

Sets the sprite for the player game object.

Parameters
spriteThe sprite to set for the player.

◆ ShiftTileIndex()

void Player.ShiftTileIndex ( int offset)

Sets the newTileIndex depending on the offset from the currentTileIndex, e.g. offset of -3 sets newTileIndex back 3 spaces.

Parameters
offsetThe number of spaces +- from the currentTileIndex

◆ TakeMoney()

void Player.TakeMoney ( int amount)

Takes a specified amount of money from the player.

Parameters
amountThe amount of money to take from the player.

◆ WinAuction()

void Player.WinAuction ( Property property,
int price )

Gives the player the property that was auctioned for the auction price and gives them the title deed card.

Parameters
propertyThe auctioned property
priceThe auction price

The documentation for this class was generated from the following file: