forked from rcatolino/bubbles-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.cpp
More file actions
47 lines (39 loc) · 784 Bytes
/
player.cpp
File metadata and controls
47 lines (39 loc) · 784 Bytes
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
#include "player.h"
Player::Player(){
}
Player::Player(QVariantMap map)
:Actor(map)
{
name = map["name"].toString();
life = map["life"].toInt();
deaths = map["deaths"].toInt();
kills = map["kills"].toInt();
}
void Player::update(QVariantMap map)
{
Actor::update(map);
if (map.contains("name"))
name = map["name"].toString();
if (map.contains("life"))
life = map["life"].toInt();
if (map.contains("deaths"))
deaths = map["deaths"].toInt();
if (map.contains("kills"))
kills = map["kills"].toInt();
}
int Player::getLife() const
{
return life;
}
int Player::getKills() const
{
return kills;
}
int Player::getDeaths() const
{
return deaths;
}
QString Player::getName() const
{
return name;
}