Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/lastmanstanding/src/orxonox/gametypes/LastManStanding.h @ 7480

Last change on this file since 7480 was 7480, checked in by jo, 14 years ago

initial upload

File size: 3.7 KB
Line 
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:
23 *      Johannes Ritz
24 *   Co-authors:
25 *      ...
26 *
27 */
28/**
29    @file LastManStanding.h
30    @brief Declaration of the Gametype "Last Man Standing".
31*/
32/* BY THE WAY
33//You have to add bots (or any other further players) before actually starting a match.
34//Whenever there is only on player in the game, this player will be declared as winner.
35//How "death" is managed: Death players become invisivle and aren't allowed to damage any player.
36//Though they can recieve damage and they are not invisible on the radar-
37*/
38#ifndef _LastManStanding_H__
39#define _LastManStanding_H__
40
41#include "OrxonoxPrereqs.h"
42#include "Gametype.h"
43#include <map>
44#include <vector>
45
46namespace orxonox
47{
48    class _OrxonoxExport LastManStanding : public Gametype
49    {
50    /**
51    @brief
52        Last Man Standing is a gametype where each player fights against each other, until one player remains.
53    @author
54        Johannes Ritz
55    */
56        protected:
57            int lives; //!< Standard amount of lives.
58            std::map< PlayerInfo*, int > playerLives_; //!< Each player's lives are stored here.
59            int playersAlive; //!< Counter counting players with more than 0 lives.
60            float timeRemaining; //!< Each player has a certain time where he or she has to hit an opponent or will be punished.
61            std::map<PlayerInfo*, float> timeToAct_; //!< Each player's time till she/he will be punished is stored here.
62
63        public:
64            LastManStanding(BaseObject* creator); //!< Default Constructor.
65            virtual ~LastManStanding() {} //!< Default Destructor.
66            void setConfigValues(); //!< Makes values configurable.
67
68            virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0); //!< Prevents hits by players with no lives.
69            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponet, his punishment countdown will be resetted. Prevents damage by players with no lives.
70            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each lives.
71
72            virtual void start(); //!< Sends a start message.
73            virtual void end(); //!< Sends an end message.
74            virtual void playerEntered(PlayerInfo* player);
75            virtual bool playerLeft(PlayerInfo* player);
76            virtual bool playerChangedName(PlayerInfo* player);
77
78            virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn);//makes dead players invisible
79            virtual void pawnPostSpawn(Pawn* pawn); //just for test case
80            virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
81
82            const int playerGetLives(PlayerInfo* player);
83            void killPlayer(PlayerInfo* player);
84            //void removePlayer(PlayerInfo* player);
85            void tick (float dt);// used to end the game
86    };
87}
88
89#endif /* _LastManStanding_H__ */
Note: See TracBrowser for help on using the repository browser.