Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/gametypes/LastTeamStanding.h @ 11071

Last change on this file since 11071 was 11071, checked in by landauf, 8 years ago

merged branch cpp11_v3 back to trunk

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