42#pragma region static_functions
62#pragma region overridden_functions
66 return std::make_unique<PlayerTurn>(*
this);
69 auto onUpdate(
float dt) ->
void override;
76 auto onSceneStart(
const std::string& sceneName) ->
void override;
77 auto onSceneExit(
const std::string& sceneName) ->
void override;
78 auto load(
const Stream& stream) ->
void override;
79 auto save(
Stream& stream)
const ->
void override;
83#pragma region PlayerTurn_Functions
213#pragma region member_variables
247#pragma region helper_functions
251#pragma region static_variables
sys::Json Stream
Definition AudioObject.h:20
The card component that is moved around on the board.
Holds a hand after it has been ranked, storing both the entire hand and the important cards.
The class that holds the top node, and manages the main game loop, as well as startup and shutdown.
The system that handles gameplay functions to communicate back to Table.
The component responsible for storing information relevant to the player.
GameObject(std::string typeName, gobj::Type parentType, gobj::Type type)
constructor for gameobject.
Definition GameObject.cpp:24
The component responsible for storing information relevant to the player.
Definition Player.h:31
Type
Definition System.h:20
@ PlayerTurn
Definition System.h:32
System(const std::string &typeName, Type systemType)
Definition System.cpp:75
Definition GameRules.h:29
auto addScore() -> void
A cheat code that adds 100 to a player's score.
Definition PlayerTurn.cpp:530
auto goToWinScreen() const -> void
Moves the game to the win screen.
Definition PlayerTurn.cpp:502
auto clone() const -> std::unique_ptr< GameObject > override
makes a copy a GameObject even if it's held polymorphically
Definition PlayerTurn.h:64
static auto getEnum() -> Type
function required by all systems
Definition PlayerTurn.h:47
Table * table
A cache of Table so we can call its functions.
Definition PlayerTurn.h:216
auto undoLastPlayedCard() const -> void
Moves the last played card back to the players hand.
Definition PlayerTurn.cpp:361
auto generatePlayerScoresData() const -> Stream
Resets all caches and values for table.
Definition PlayerTurn.cpp:430
PlayerTurn()
Definition PlayerTurn.cpp:51
std::vector< int > playerInputIDs
Vector used to track which input device IDs correspond to what player.
Definition PlayerTurn.h:237
auto changePlayers() -> void
Gives next player control.
Definition PlayerTurn.cpp:160
std::vector< Card * > cardsPlayedThisTurn
Vector of all cards that have been played, primarily used for updating the "playedThisTurn" variable ...
Definition PlayerTurn.h:222
std::stack< std::pair< Card *, std::pair< int, int > > > redoBuffer
Buffer that stores where cards were intended to be placed, then undone.
Definition PlayerTurn.h:240
GameRules * gameRules
Ruleset to follow for things like cards in hand, size of board, etc.
Definition PlayerTurn.h:231
auto cardSelected(const Message *message) -> void
Moves selected card to be placed on board.
Definition PlayerTurn.cpp:281
auto getWinningPlayer() const -> Player *
Gets the current winning player based off score.
Definition PlayerTurn.cpp:464
auto moveTurnForward() -> void
Scores the board, resets the "playedThisTurn" flag.
Definition PlayerTurn.cpp:129
auto cardDeselected() const -> void
Brings previously selected card back to hand.
Definition PlayerTurn.cpp:292
auto drawCard() -> void
A cheat code that manually draws a card to a player's hand.
Definition PlayerTurn.cpp:398
auto onSceneExit(const std::string &sceneName) -> void override
Hook that is called right before a scene is unloaded To receive the hook, simply override the functio...
Definition PlayerTurn.cpp:100
auto getCurrentPlayer() const -> Player *
Gets who the current player should be based on the turn.
Definition PlayerTurn.cpp:483
auto endWindow() -> void override
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Definition PlayerTurn.h:72
int turn
Tracker of how many times a player has played their cards on the board. Starts at 0.
Definition PlayerTurn.h:234
auto load(const Stream &stream) -> void override
Implementations will load the state of a GameObject from a th::Json Object.
Definition PlayerTurn.cpp:114
auto setPlayerInputIDs(const std::vector< int > &IDs) -> void
Sets the IDs for all the players that will be participating in the game, in turn order.
Definition PlayerTurn.cpp:520
auto redoLastPlayedCard() -> void
Moves the last undone card back onto the board.
Definition PlayerTurn.cpp:370
auto arePlayersEmpty() const -> bool
Checks if all players have empty hands.
Definition PlayerTurn.cpp:493
Card * lastSelectedCard
Tracker of the last selected card, so we know what we're playing.
Definition PlayerTurn.h:219
auto save(Stream &stream) const -> void override
Implementations will load the state of a GameObject to a th::Json object.
Definition PlayerTurn.cpp:119
PlayerTurn(PlayerTurn &&other) noexcept=default
auto resetScores() -> void
Sets all scores to 0.
Definition PlayerTurn.cpp:414
auto onRender() -> void override
called every frame after update has been called for every object.
Definition PlayerTurn.cpp:82
auto getCurrentPlayerNumber() const -> int
Gets who the current player should be based on the turn.
Definition PlayerTurn.cpp:478
auto operator=(PlayerTurn &&other) noexcept -> PlayerTurn &=default
auto updatedCardsPlayedThisTurn() -> void
Sets "playedThisTurn" for cards played this turn to false, then empties the vector Typically called a...
friend class GameRules
Definition PlayerTurn.h:256
~PlayerTurn() override=default
std::vector< int > playerScores
Scores for each player for the current game.
Definition PlayerTurn.h:228
auto getCardsPlayedThisTurn() -> std::vector< Card * >
Definition PlayerTurn.cpp:388
auto getPlayerInputIDs() const -> const std::vector< int > &
Gets all the IDs of the players participating in the game.
Definition PlayerTurn.cpp:525
auto cardPlayedOnBoard(const Message *message) -> void
Checks if card placement was valid.
Definition PlayerTurn.cpp:300
auto onUpdate(float dt) -> void override
called once every frame.
Definition PlayerTurn.cpp:72
auto onSceneStart(const std::string &sceneName) -> void override
Hook that is called before the first frame a scene is run, but after the entire scene is loaded into ...
Definition PlayerTurn.cpp:86
bool playersChanging
Bool that keeps track of whether or not players are changing.
Definition PlayerTurn.h:243
auto systemShowMenu() -> void override
Specific systems should override this function to show their specific menu for the system.
Definition PlayerTurn.cpp:77
auto operator=(const PlayerTurn &other) -> PlayerTurn &
Definition PlayerTurn.cpp:58
int playerCardsPlaced
Keeps track of how many cards have been placed to see if limit has been hit.
Definition PlayerTurn.h:225
auto getLastSelectedCard() -> Card *
Definition PlayerTurn.cpp:393
auto resetTable() -> void
Resets all caches and values for table.
Definition PlayerTurn.cpp:455
auto getPlayersChanging() -> bool
If players are currently being changed or not.
Definition PlayerTurn.cpp:276
auto playerTimerRanOut(int playerNumber) -> void
Definition PlayerTurn.cpp:348
friend class Table
Definition PlayerTurn.h:255
PlayerTurn(const PlayerTurn &other)=default
auto getPlayerScores() const -> std::vector< int >
Gets who the current player should be based on the turn.
Definition PlayerTurn.cpp:488
The system responsible for facilitating communication between gameplay components (Players,...
Definition Table.h:48
the type of elements in a basic_json container
Definition GameObject.h:37