Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/MouseAPI_FS19/src/modules/MouseAPI/mousegametype.cc @ 12301

Last change on this file since 12301 was 12301, checked in by tkuonen, 5 years ago
File size: 1.0 KB
Line 
1#include "mousegametype.h"
2namespace orxonox
3{
4RegisterUnloadableClass(MouseGametype);
5MouseGametype::MouseGametype(Context* context):Gametype(context)
6{
7    RegisterObject(MouseGametype);
8    player_ =nullptr;
9
10}
11void 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
25void 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
34void 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.