Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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
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    //Activate the Mouse Cursor
11    this->setHUDTemplate("MouseCursor");
12
13}
14
15void MouseGametype::start()
16{
17    Gametype::start();
18}
19
20void 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
29void MouseGametype::spawnPlayer(PlayerInfo* player)
30{
31    assert(player);
32    //Only Spawn once
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.