You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
568 B
32 lines
568 B
#include "Player.h"
|
|
|
|
Player::Player(std::string name)
|
|
: name_{name}
|
|
{}
|
|
|
|
const std::string& Player::getName() const {
|
|
return name_;
|
|
}
|
|
|
|
uint32_t Player::getHighScore() const {
|
|
return high_score_;
|
|
}
|
|
|
|
void Player::play(){
|
|
Controller controller;
|
|
|
|
while (controller.wantsToQuit() == false) {
|
|
controller.readInput();
|
|
|
|
if (controller.act() == DEFEAT) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
const uint32_t score = controller.getCurrScore();
|
|
controller.resetScore();
|
|
|
|
if (score > high_score_) {
|
|
high_score_ = score;
|
|
}
|
|
}
|