Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Add first version of mousecursor

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