Last change
on this file since 12377 was
12377,
checked in by tkuonen, 5 years ago
|
Improve MouseAPI
Add Comments
Cleanup
|
File size:
864 bytes
|
Rev | Line | |
---|
[12296] | 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 | |
---|
[12377] | 10 | //Activate the Mouse Cursor |
---|
[12363] | 11 | this->setHUDTemplate("MouseCursor"); |
---|
| 12 | |
---|
[12296] | 13 | } |
---|
[12309] | 14 | |
---|
[12363] | 15 | void MouseGametype::start() |
---|
| 16 | { |
---|
[12296] | 17 | Gametype::start(); |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | void MouseGametype::spawnPlayersIfRequested() |
---|
| 21 | { |
---|
| 22 | // Spawn a human player. |
---|
| 23 | for (const auto& mapEntry : this->players_) |
---|
| 24 | if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) |
---|
| 25 | this->spawnPlayer(mapEntry.first); |
---|
| 26 | } |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | void MouseGametype::spawnPlayer(PlayerInfo* player) |
---|
| 30 | { |
---|
| 31 | assert(player); |
---|
[12377] | 32 | //Only Spawn once |
---|
[12296] | 33 | if(this->player_ == nullptr) |
---|
| 34 | { |
---|
| 35 | this->player_ = player; |
---|
| 36 | this->players_[player].state_ = PlayerState::Alive; |
---|
| 37 | } |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.