Line | |
---|
1 | #include "mousegametype.h" |
---|
2 | namespace orxonox |
---|
3 | { |
---|
4 | RegisterUnloadableClass(MouseGametype); |
---|
5 | MouseGametype::MouseGametype(Context* context):Gametype(context) |
---|
6 | { |
---|
7 | RegisterObject(MouseGametype); |
---|
8 | player_ =nullptr; |
---|
9 | |
---|
10 | } |
---|
11 | void MouseGametype::start(){ |
---|
12 | |
---|
13 | bool temp = this->bForceSpawn_; |
---|
14 | this->bForceSpawn_ = true; |
---|
15 | |
---|
16 | // Call start for the parent class. |
---|
17 | Gametype::start(); |
---|
18 | |
---|
19 | // Reset the variable. |
---|
20 | this->bForceSpawn_ = temp; |
---|
21 | |
---|
22 | InputManager::getInstance().setMouseExclusive("game",false);//set show mouse, see guimanager |
---|
23 | } |
---|
24 | |
---|
25 | void MouseGametype::spawnPlayersIfRequested() |
---|
26 | { |
---|
27 | // Spawn a human player. |
---|
28 | for (const auto& mapEntry : this->players_) |
---|
29 | if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) |
---|
30 | this->spawnPlayer(mapEntry.first); |
---|
31 | } |
---|
32 | |
---|
33 | |
---|
34 | void MouseGametype::spawnPlayer(PlayerInfo* player) |
---|
35 | { |
---|
36 | assert(player); |
---|
37 | |
---|
38 | if(this->player_ == nullptr) |
---|
39 | { |
---|
40 | this->player_ = player; |
---|
41 | this->players_[player].state_ = PlayerState::Alive; |
---|
42 | |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.