-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.cpp
65 lines (41 loc) · 1.37 KB
/
player.cpp
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
/**
* @file player.h
* @author Edem & Miguel
* @brief Fichier .cpp de la classe Player
*/
#include "player.h"
//Constructeur
Player::Player(string name):name{name} {}
// Getters
int Player::getId(){return id;}
int Player::getRemainingWall(){return wallRemaining;}
string Player::getName(){return name;}
bool Player::isTimerCounting(){return timer.isCounting();}
bool Player::isTimerEmpty(){return timer.isEmpty();}
string Player::getRemainingTime(){return timer.getRemainingTime();}
Point Player::getPoint(){return coord;}
Point Player::getStart_Point(){return start_coord;}
// Setters
void Player::setId(int newId){id = newId;}
void Player::setTimer(int time){timer.setTimer(time);}
void Player::loadTimer(string storedTimer){timer.loadTimer(storedTimer);}
void Player::setCoord(Point pt){coord = pt;}
void Player::setStart_coord(Point pt){start_coord = pt;}
void Player::setWallBank(int nbrWalls){wallRemaining = nbrWalls;}
// Others
void Player::startTimer(){timer.start_timer();}
void Player::stopTimer(){timer.stop_timer();}
void Player::removeWall(){wallRemaining--;}
bool Player::isWinningCoord(Point pt){
if (start_coord.x == 0 && pt.x == 8){
return true;
}else if (start_coord.x == 8 && pt.x == 0){
return true;
}else if (start_coord.y == 0 && pt.y == 8){
return true;
}else if (start_coord.y == 8 && pt.y == 0){
return true;
}else{
return false;
}
}