38#pragma region static_functions
58#pragma region overridden_functions
62 return std::make_unique<PlayerTurn>(*
this);
65 auto onUpdate(
float dt) ->
void override;
72 auto onSceneStart(
const std::string& sceneName) ->
void override;
73 auto onSceneExit(
const std::string& sceneName) ->
void override;
74 auto load(
const Stream& stream) ->
void override;
75 auto save(
Stream& stream)
const ->
void override;
79#pragma region PlayerTurn_Functions
187#pragma region member_variables
215#pragma region helper_functions
219#pragma region static_variables
sys::Json Stream
Definition AudioObject.h:20
The card component that is moved around on the board.
The class that holds the top node, and manages the main game loop, as well as startup and shutdown.
A helper struct that contains all relevant rules for gameplay for the 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:23
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
auto addScore() -> void
A cheat code that adds 100 to a player's score.
Definition PlayerTurn.cpp:502
auto goToWinScreen() const -> void
Moves the game to the win screen.
Definition PlayerTurn.cpp:474
auto clone() const -> std::unique_ptr< GameObject > override
makes a copy a GameObject even if it's held polymorphically
Definition PlayerTurn.h:60
static auto getEnum() -> Type
function required by all systems
Definition PlayerTurn.h:43
Table * table
A cache of Table so we can call its functions.
Definition PlayerTurn.h:190
auto cardDeselected() -> void
Brings previously selected card back to hand.
Definition PlayerTurn.cpp:304
auto generatePlayerScoresData() const -> Stream
Resets all caches and values for table.
Definition PlayerTurn.cpp:407
PlayerTurn()
Definition PlayerTurn.cpp:49
std::vector< int > playerInputIDs
Vector used to track which input device IDs correspond to what player.
Definition PlayerTurn.h:211
std::vector< Card * > cardsPlayedThisTurn
Vector of all cards that have been played, primarily used for updating the "playedThisTurn" variable ...
Definition PlayerTurn.h:196
auto cardSelected(const Message *message) -> void
Moves selected card to be placed on board.
Definition PlayerTurn.cpp:293
auto getWinningPlayer() const -> Player *
Gets the current winning player based off score.
Definition PlayerTurn.cpp:441
auto playScoredSound() const -> void
Plays a sound effect when scoring.
Definition PlayerTurn.cpp:381
auto moveTurnForward() -> void
Scores the board, resets the "playedThisTurn" flag, and gives next player control.
Definition PlayerTurn.cpp:124
auto drawCard() -> void
A cheat code that manually draws a card to a player's hand.
Definition PlayerTurn.cpp:367
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:95
auto getCurrentPlayer() const -> Player *
Gets who the current player should be based on the turn.
Definition PlayerTurn.cpp:460
auto endWindow() -> void override
currently unused, but intended to but was assumed to be necessary for a proper ImGui editor
Definition PlayerTurn.h:68
int turn
Tracker of how many times a player has played their cards on the board. Starts at 0.
Definition PlayerTurn.h:208
auto load(const Stream &stream) -> void override
Implementations will load the state of a GameObject from a th::Json Object.
Definition PlayerTurn.cpp:109
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:492
auto arePlayersEmpty() const -> bool
Checks if all players have empty hands.
Definition PlayerTurn.cpp:465
Card * lastSelectedCard
Tracker of the last selected card, so we know what we're playing.
Definition PlayerTurn.h:193
auto movePlayerCards(float direction, float cardDelay) -> void
+1 for the direction will move player cards up and highlight them, -1 for the direction will move pla...
Definition PlayerTurn.cpp:205
auto save(Stream &stream) const -> void override
Implementations will load the state of a GameObject to a th::Json object.
Definition PlayerTurn.cpp:114
PlayerTurn(PlayerTurn &&other) noexcept=default
auto resetScores() -> void
Sets all scores to 0.
Definition PlayerTurn.cpp:391
auto onRender() -> void override
called every frame after update has been called for every object.
Definition PlayerTurn.cpp:79
auto getCurrentPlayerNumber() const -> int
Gets who the current player should be based on the turn.
Definition PlayerTurn.cpp:455
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...
Definition PlayerTurn.cpp:358
~PlayerTurn() override=default
std::vector< int > playerScores
Scores for each player for the current game.
Definition PlayerTurn.h:202
auto getPlayerInputIDs() const -> const std::vector< int > &
Gets all the IDs of the players participating in the game.
Definition PlayerTurn.cpp:497
auto cardPlayedOnBoard(const Message *message) -> void
Checks if card placement was valid.
Definition PlayerTurn.cpp:309
auto onUpdate(float dt) -> void override
called once every frame.
Definition PlayerTurn.cpp:69
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:83
auto systemShowMenu() -> void override
Specific systems should override this function to show their specific menu for the system.
Definition PlayerTurn.cpp:74
auto operator=(const PlayerTurn &other) -> PlayerTurn &
Definition PlayerTurn.cpp:55
int playerCardsPlaced
Keeps track of how many cards have been placed to see if limit has been hit.
Definition PlayerTurn.h:199
GameRules gameRules
Ruleset to follow for things like cards in hand, size of board, etc.
Definition PlayerTurn.h:205
auto resetTable() -> void
Resets all caches and values for table.
Definition PlayerTurn.cpp:432
friend class Table
Definition PlayerTurn.h:223
PlayerTurn(const PlayerTurn &other)=default
The system responsible for facilitating communication between gameplay components (Players,...
Definition Table.h:47
the type of elements in a basic_json container
Definition GameObject.h:32
An indicator that loops through a parents' nodes children and can "select" them on keypress.
Definition GameRules.h:30