Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added MouseGametype

File size: 938 bytes
Line 
1#include "mousegametype.h"
2
3namespace orxonox
4{
5RegisterUnloadableClass(MouseGametype);
6MouseGametype::MouseGametype(Context* context):Gametype(context)
7{
8    RegisterObject(MouseGametype);
9    player_ =nullptr;
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}
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.