Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 12363 was 12363, checked in by tkuonen, 5 years ago

Added MouseCursor

File size: 979 bytes
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    this->setHUDTemplate("MouseCursor");
11
12}
13
14void MouseGametype::start()
15{
16    bool temp = this->bForceSpawn_;
17    this->bForceSpawn_ = true;
18
19    // Call start for the parent class.
20    Gametype::start();
21
22    // Reset the variable.
23    this->bForceSpawn_ = temp;
24
25}
26
27void MouseGametype::spawnPlayersIfRequested()
28{
29    // Spawn a human player.
30    for (const auto& mapEntry : this->players_)
31        if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_))
32            this->spawnPlayer(mapEntry.first);
33}
34
35
36void MouseGametype::spawnPlayer(PlayerInfo* player)
37{
38    assert(player);
39
40    if(this->player_ == nullptr)
41    {
42        this->player_ = player;
43        this->players_[player].state_ = PlayerState::Alive;
44    }
45}
46
47}
Note: See TracBrowser for help on using the repository browser.