GigaPasjans
Loading...
Searching...
No Matches
Game::CardInteraction Struct Reference

Represents an interaction where a single card is moved. More...

#include <InteractionManager.h>

Inheritance diagram for Game::CardInteraction:
Collaboration diagram for Game::CardInteraction:

Public Member Functions

 CardInteraction (::Game::Card *card, CardStack *stack)
 
void Do () override
 Executes the interaction.
 
void Undo () override
 Reverts the interaction.
 
void Serialize (nlohmann::json &obj) override
 Serializes the interaction to JSON.
 

Static Public Member Functions

static CardInteraction * Load (nlohmann::json &obj)
 Loads a card interaction from JSON.
 

Public Attributes

Card * Card
 The card involved in the interaction.
 
CardStack * Stack
 Destination stack.
 
CardStack * PreviousStack
 Original stack before the move.
 
int32 PreviousIndex
 Original index of the card.
 
int32 FlippedCardIndex = -1
 Index of a card flipped during the move, if any.
 
- Public Attributes inherited from Game::IInteraction
InteractionType Type
 Type of the interaction.
 

Static Public Attributes

static Card * Grabbed = nullptr
 Currently selected card (global state).
 

Detailed Description

Represents an interaction where a single card is moved.

Member Function Documentation

◆ Do()

void Game::CardInteraction::Do ( )
overridevirtual

Executes the interaction.

Reimplemented from Game::IInteraction.

◆ Serialize()

void Game::CardInteraction::Serialize ( nlohmann::json & obj)
overridevirtual

Serializes the interaction to JSON.

Reimplemented from Game::IInteraction.

◆ Undo()

void Game::CardInteraction::Undo ( )
overridevirtual

Reverts the interaction.

Reimplemented from Game::IInteraction.


The documentation for this struct was generated from the following files: