-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathplayer.cpp
More file actions
56 lines (42 loc) · 1023 Bytes
/
player.cpp
File metadata and controls
56 lines (42 loc) · 1023 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
48
49
50
51
52
53
54
55
56
#include "GameBall/logic/player.h"
#include "GameBall/logic/world.h"
namespace GameBall::Logic {
Player::Player(World *world) : world_(world) {
player_id_ = world_->RegisterPlayer(this);
}
Player::~Player() {
world_->UnregisterPlayer(player_id_);
}
uint64_t Player::PlayerId() const {
return player_id_;
}
uint64_t Player::PrimaryUnitId() const {
return primary_unit_id_;
}
uint64_t Player::LargeUnitId() const {
return large_unit_id_;
}
uint64_t Player::SmallUnitId() const {
return small_unit_id_;
}
void Player::SetPrimaryUnit(uint64_t unit_id) {
primary_unit_id_ = unit_id;
}
void Player::SetLargeUnit(uint64_t unit_id) {
large_unit_id_ = unit_id;
}
void Player::SetSmallUnit(uint64_t unit_id) {
small_unit_id_ = unit_id;
}
void Player::SetInput(const PlayerInput &input) {
input_ = input;
}
PlayerInput Player::GetPlayerInput() const {
return input_;
}
PlayerInput Player::TakePlayerInput() {
auto input = input_;
input_ = {};
return input;
}
} // namespace GameBall::Logic