Orxonox  0.0.5 Codename: Arcturus
LastManStanding.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 _LastManStanding_H__
34 #define _LastManStanding_H__
35 
36 #include "OrxonoxPrereqs.h"
37 #include "Deathmatch.h"
38 #include <map>
39 #include <vector>
40 
41 namespace orxonox
42 {
44  {
51  protected:
52  int lives;
53  std::map< PlayerInfo*, int > playerLives_;
55  float timeRemaining;
56  std::map<PlayerInfo*, float> timeToAct_;
57  float respawnDelay;
58  std::map<PlayerInfo*, float> playerDelayTime_;
59  std::map<PlayerInfo*, bool> inGame_;
63  virtual void spawnDeadPlayersIfRequested() override;
64  virtual int getMinLives();
65 
66  public:
67  LastManStanding(Context* context);
68  virtual ~LastManStanding() {}
69  void setConfigValues();
70 
71  virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override;
72  virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override;
73 
74  virtual void end() override;
75  int playerGetLives(PlayerInfo* player);
76  int getNumPlayersAlive() const;
77  virtual void playerEntered(PlayerInfo* player) override;
78  virtual bool playerLeft(PlayerInfo* player) override;
79  virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override;
80 
81  void punishPlayer(PlayerInfo* player);
82  virtual void tick (float dt) override;
83  };
84 }
85 
86 #endif /* _LastManStanding_H__ */
Definition: LastManStanding.h:43
Everything in Orxonox that has a health attribute is a Pawn.
Definition: Pawn.h:56
std::map< PlayerInfo *, int > playerLives_
Each player&#39;s lives are stored here.
Definition: LastManStanding.h:53
std::map< PlayerInfo *, float > playerDelayTime_
Stores each Player&#39;s delay time.
Definition: LastManStanding.h:58
std::map< PlayerInfo *, float > timeToAct_
Each player&#39;s time till she/he will be punished is stored here.
Definition: LastManStanding.h:56
int playersAlive
Counter counting players with more than 0 lives.
Definition: LastManStanding.h:54
std::map< PlayerInfo *, bool > inGame_
Indicates each Player&#39;s state.
Definition: LastManStanding.h:59
float punishDamageRate
Makes Damage adjustable.
Definition: LastManStanding.h:62
bool bNoPunishment
Config value to switch off Punishment function if it is set to true.
Definition: LastManStanding.h:60
virtual ~LastManStanding()
Default Destructor.
Definition: LastManStanding.h:68
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Shared library macros, enums, constants and forward declarations for the orxonox library ...
Definition: Context.h:45
#define _OrxonoxExport
Definition: OrxonoxPrereqs.h:60
float timeRemaining
Each player has a certain time where he or she has to hit an opponent or will be punished.
Definition: LastManStanding.h:55
Definition: Deathmatch.h:37
bool bHardPunishment
Switches between damage and death as punishment.
Definition: LastManStanding.h:61
Definition: PlayerInfo.h:39
int lives
Last Man Standing is a gametype where each player fights against each other, until one player remains...
Definition: LastManStanding.h:52
float respawnDelay
Time in seconds when a player will respawn after death.
Definition: LastManStanding.h:57