Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/output/src/orxonox/gametypes/Asteroids.cc @ 8822

Last change on this file since 8822 was 8822, checked in by landauf, 13 years ago

Chat works again
Removed console output for almost all gameplay messages (use chat/notifications instead)
Deathmatch level now actually uses Deathmatch gametype

  • Property svn:eol-style set to native
File size: 2.4 KB
RevLine 
[2905]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
[3020]23 *      Aurelian Jaggi
[2905]24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "Asteroids.h"
30
31#include "core/CoreIncludes.h"
[3196]32#include "network/Host.h"
[5735]33#include "worldentities/pawns/Pawn.h"
[2905]34
35namespace orxonox
36{
37    CreateUnloadableFactory(Asteroids);
38
39    Asteroids::Asteroids(BaseObject* creator) : Gametype(creator)
40    {
41        RegisterObject(Asteroids);
[2970]42        this->firstCheckpointReached_ = false;
[7655]43        this->numberOfBots_=0; //sets number of default bots temporarly to 0
[2905]44    }
45
[2970]46    void Asteroids::tick(float dt)
47    {
48        SUPER(Asteroids, tick, dt);
[3020]49
[2978]50        if (firstCheckpointReached_ && !this->timerIsActive_)
[2970]51        {
52            this->startTimer();
53        }
54
[2978]55        if (this->time_ < 0 && !this->hasEnded() && this->timerIsActive_)
[2970]56        {
[5929]57            this->gtinfo_->sendAnnounceMessage("Time's up - you have lost the match!");
[2970]58            this->end();
59        }
60    }
61
[3056]62    void Asteroids::pawnKilled(Pawn* victim, Pawn* killer)
[2986]63    {
[3056]64        if (victim && victim->getPlayer())
[2986]65        {
[5929]66            this->gtinfo_->sendAnnounceMessage("You're dead - you have lost the match!");
[2986]67            this->end();
68        }
69    }
70
[2905]71    void Asteroids::start()
72    {
73        Gametype::start();
74
[6417]75        std::string message("The match has started! Reach the first chekpoint within 15 seconds! But be aware, there may be pirates around...");
[2905]76        Host::Broadcast(message);
[7655]77
[2905]78    }
79
[2936]80    void Asteroids::end()
[2905]81    {
82        Gametype::end();
83
[6417]84        std::string message("The match has ended.");
[2905]85        Host::Broadcast(message);
86    }
87}
Note: See TracBrowser for help on using the repository browser.