-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.cpp
61 lines (52 loc) · 1.17 KB
/
game.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
#include<game.h>
Game::Game(){
game_begin=false;
};
void Game::FirstGame(){
EnemyRoles.clear();
OurRoles.clear();
this->round=1;
this->money=40;
game_begin=true;
enemy_timer.start(200000);
enemy_timer.setSingleShot(true);
this->batch=0;
this->killed=0;
}
void Game::SecondGame(){
EnemyRoles.clear();
OurRoles.clear();
this->round=2;
this->money=40;
this->killed=0;
game_begin=true;
this->batch=0;
enemy_timer.start(200000);
enemy_timer.setSingleShot(true);
}
MyRole*Game::GetRole(GridVec pos){
{
for(auto role:OurRoles){
if(role->posi==pos.i&&role->posj==pos.j){
return role;
}
}
return nullptr;
}
}
bool Game::IsValid(GridVec pos){
for(auto role:OurRoles){
if(role->posi==pos.i&&role->posj==pos.j)return false;
}
return true;
}
//todo 检测是否有东西,并从OurRoles列表移除
void Game::RemoveRole(GridVec pos){
for(auto role:this->OurRoles){
if(role->posi==pos.i&&role->posj==pos.j){
this->OurRoles.removeOne(role);
return;
}
}
return;
}