Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/lastmanstanding2/src/orxonox/gametypes/LastTeamStanding.h @ 7697

Last change on this file since 7697 was 7697, checked in by dafrick, 13 years ago

Manually merging changes in lastmanstanding branch to lastmanstanding2 branch.
Please continue here, since the lastmanstanding branch has already been merged.

File size: 4.1 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 LastTeamStanding.h
30    @brief Declaration of the Gametype "Last Team Standing".
31*/
32
33#ifndef _LastTeamStanding_H__
34#define _LastTeamStanding_H__
35
36#include "OrxonoxPrereqs.h"
37#include "Deathmatch.h"
38#include <map>
39#include <vector>
40
41namespace orxonox
42{
43    class _OrxonoxExport LastTeamStanding : public TeamDeathmatch
44    {
45    /**
46    @brief
47        Last Team Standing is a gametype where each team fights against each other, until one team remains.
48    @author
49        Johannes Ritz
50    */
51        protected:
52            int lives; //!< Standard amount of lives. Each player starts a game with so many lives.
53            std::map< PlayerInfo*, int > playerLives_; //!< Each player's lives are stored here.
54            int teamsAlive; //!< Counter counting teams with more than one player remaining.
55            float timeRemaining; //!< Each player has a certain time where he or she has to hit an opponent or will be punished.
56            std::map<PlayerInfo*, float> timeToAct_; //!< Each player's time till she/he will be punished is stored here.
57            float respawnDelay; //!<Time in seconds when a player will respawn after death.
58            std::map<PlayerInfo*, float> playerDelayTime_; //!< Stores each Player's delay time.
59            std::map<PlayerInfo*, bool> inGame_; //!< Indicates each Player's state.
60            bool bNoPunishment; //!< Config value to switch off Punishment function if it is set to true.
61            bool bHardPunishment; //!< Switches between damage and death as punishment.
62            float punishDamageRate; //!< Makes Damage adjustable.
63            virtual void spawnDeadPlayersIfRequested(); //!< Prevents dead players to respawn.
64            virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped;
65            unsigned int * eachTeamsPlayers; //!<Each teams player's alive.
66
67        public:
68            LastTeamStanding(BaseObject* creator); //!< Default Constructor.
69            virtual ~LastTeamStanding(); //!< Default Destructor.
70            void setConfigValues(); //!< Makes values configurable.
71
72            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponent, his punishment countdown will be resetted.
73            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each players lives.
74
75            virtual void end(); //!< Sends an end message.
76            int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_".
77            int getNumTeamsAlive() const; //!< Returns the number of players that are still alive.
78            virtual void playerEntered(PlayerInfo* player); //!< Initializes values.
79            virtual bool playerLeft(PlayerInfo* player); //!< Manages all local variables.
80            virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn); //!< Resets punishment time and respawn delay.
81
82            void punishPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining".
83            void tick (float dt); //!< used to end the game
84    };
85}
86
87#endif /* _LastTeamStanding_H__ */
Note: See TracBrowser for help on using the repository browser.