Orxonox  0.0.5 Codename: Arcturus
LastTeamStanding.h
Go to the documentation of this file.
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  */
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 
43 namespace orxonox
44 {
46  {
53  protected:
54  int lives;
55  std::map< PlayerInfo*, int > playerLives_;
56  std::vector<int> eachTeamsPlayers;
57  int teamsAlive;
58 //Data for CamperPunishment
59  float timeRemaining;
60  std::map<PlayerInfo*, float> timeToAct_;
64 //Data for RespawnDelay
65  float respawnDelay;
66  std::map<PlayerInfo*, float> playerDelayTime_;
67  std::map<PlayerInfo*, bool> inGame_;
68 
69  virtual void spawnDeadPlayersIfRequested() override;
70  virtual int getMinLives();
71 
72  public:
73  LastTeamStanding(Context* context);
74  virtual ~LastTeamStanding();
75 
76  virtual void playerEntered(PlayerInfo* player) override;
77  virtual bool playerLeft(PlayerInfo* player) override;
78 
79  virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override;
80  virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override;
81  virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override;
82  virtual void tick (float dt) override;
83  virtual void end() override;
84  void punishPlayer(PlayerInfo* player);
85  int playerGetLives(PlayerInfo* player);
86  inline int getNumTeamsAlive() const
87  {return this->teamsAlive;}
88  void setConfigValues();
89 
90  };
91 }
92 
93 #endif /* _LastTeamStanding_H__ */
Everything in Orxonox that has a health attribute is a Pawn.
Definition: Pawn.h:56
std::vector< int > eachTeamsPlayers
Number of players in each team.
Definition: LastTeamStanding.h:56
bool bNoPunishment
Config value to switch off Punishment function if it is set to true.
Definition: LastTeamStanding.h:61
int teamsAlive
Counter counting teams with more than one player remaining.
Definition: LastTeamStanding.h:57
std::map< PlayerInfo *, int > playerLives_
Each player&#39;s lives are stored here.
Definition: LastTeamStanding.h:55
float respawnDelay
Time in seconds when a player will respawn after death.
Definition: LastTeamStanding.h:65
std::map< PlayerInfo *, float > playerDelayTime_
Stores each Player&#39;s delay time.
Definition: LastTeamStanding.h:66
Definition: LastTeamStanding.h:45
std::map< PlayerInfo *, bool > inGame_
Indicates each Player&#39;s state.
Definition: LastTeamStanding.h:67
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Definition: TeamDeathmatch.h:37
Shared library macros, enums, constants and forward declarations for the orxonox library ...
float punishDamageRate
Makes Damage adjustable.
Definition: LastTeamStanding.h:63
float timeRemaining
Each player has a certain time where he or she has to hit an opponent or will be punished.
Definition: LastTeamStanding.h:59
Definition: Context.h:45
#define _OrxonoxExport
Definition: OrxonoxPrereqs.h:60
Definition: PlayerInfo.h:39
bool bHardPunishment
Switches between damage and death as punishment.
Definition: LastTeamStanding.h:62
int getNumTeamsAlive() const
< Returns the number of players that are still alive.
Definition: LastTeamStanding.h:86
std::map< PlayerInfo *, float > timeToAct_
Each player&#39;s time till she/he will be punished is stored here.
Definition: LastTeamStanding.h:60
int lives
Last Team Standing is a gametype where each team fights against each other, until one team remains...
Definition: LastTeamStanding.h:54