-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgamedata.cpp
More file actions
71 lines (58 loc) · 1.53 KB
/
gamedata.cpp
File metadata and controls
71 lines (58 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "gamedata.h"
// Inicialização dos membros de dados na construção
GameData::GameData() : player(nullptr), enemy(nullptr) {}
// Retorna a instância única da classe GameData (singleton)
GameData* GameData::getInstance()
{
// Garante que apenas uma instância da classe seja criada
static GameData instance;
return &instance;
}
// Retorna o ponteiro para o personagem jogador
Character* GameData::getPlayer() const
{
return player;
}
// Retorna o ponteiro para o personagem inimigo
Character* GameData::getEnemy() const
{
return enemy;
}
// Retorna o resultado de ataque do jogador
AttackResult GameData::getPlayerAttackResult() const
{
return playerAttackResult;
}
// Retorna o resultado de ataque do inimigo
AttackResult GameData::getEnemyAttackResult() const
{
return enemyAttackResult;
}
// Configura o ponteiro para o personagem jogador
void GameData::setPlayer(Character* newPlayer)
{
player = newPlayer;
}
// Configura o ponteiro para o personagem inimigo
void GameData::setEnemy(Character* newEnemy)
{
enemy = newEnemy;
}
// Configura o resultado de ataque do jogador
void GameData::setPlayerAttackResult(const AttackResult& result)
{
playerAttackResult = result;
}
// Configura o resultado de ataque do inimigo
void GameData::setEnemyAttackResult(const AttackResult& result)
{
enemyAttackResult = result;
}
// Potions
int GameData::playerPotions = 15;
int GameData::getPlayerPotions() {
return playerPotions;
}
void GameData::setPlayerPotions(int potions) {
playerPotions = potions;
}