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 | * Mauro Salomon |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _RaceCheckPoint_H__ |
---|
30 | #define _RaceCheckPoint_H__ |
---|
31 | |
---|
32 | #include "gametypes/GametypesPrereqs.h" |
---|
33 | |
---|
34 | |
---|
35 | |
---|
36 | #include "objects/triggers/DistanceMultiTrigger.h" |
---|
37 | #include "interfaces/RadarViewable.h" |
---|
38 | |
---|
39 | namespace orxonox |
---|
40 | { |
---|
41 | /** |
---|
42 | @brief |
---|
43 | The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level. |
---|
44 | Don't forget to control the indexes of your check points and to set one last check point |
---|
45 | */ |
---|
46 | class _GametypesExport RaceCheckPoint : public DistanceMultiTrigger, public RadarViewable |
---|
47 | { |
---|
48 | public: |
---|
49 | RaceCheckPoint(BaseObject* creator); |
---|
50 | virtual ~RaceCheckPoint(); |
---|
51 | |
---|
52 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
53 | virtual void tick(float dt); |
---|
54 | inline void setCheckpointIndex(int checkpointIndex) |
---|
55 | { this->bCheckpointIndex_ = checkpointIndex; } |
---|
56 | inline int getCheckpointIndex() |
---|
57 | { return this->bCheckpointIndex_; } |
---|
58 | |
---|
59 | inline void setNextcheckpoint(const Vector3& checkpoints) |
---|
60 | { this->nextcheckpoints_=checkpoints; } |
---|
61 | inline void setNextcheckpoint(float x, float y, float z) |
---|
62 | { this->setNextcheckpoint(Vector3(x, y, z)); } |
---|
63 | inline const Vector3& getNextcheckpoint() const |
---|
64 | { return this->nextcheckpoints_; } |
---|
65 | inline void setLast(bool isLast) |
---|
66 | { this->bIsLast_ = isLast; } |
---|
67 | inline bool getLast() |
---|
68 | { return this->bIsLast_; } |
---|
69 | |
---|
70 | bool bIsLast_; //True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level. |
---|
71 | float bTimeLimit_; //The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses. |
---|
72 | PlayerInfo* reached_; |
---|
73 | |
---|
74 | inline float getTimeLimit() |
---|
75 | { return this->bTimeLimit_; } |
---|
76 | |
---|
77 | protected: |
---|
78 | virtual void fire(bool bIsTriggered,BaseObject* player); |
---|
79 | virtual void setTimelimit(float timeLimit); |
---|
80 | |
---|
81 | inline const WorldEntity* getWorldEntity() const |
---|
82 | { return this; } |
---|
83 | |
---|
84 | private: |
---|
85 | int bCheckpointIndex_; //The index of this check point. The race starts with the check point with the index 0 |
---|
86 | Vector3 nextcheckpoints_; //the indexes of the next check points |
---|
87 | |
---|
88 | }; |
---|
89 | } |
---|
90 | |
---|
91 | #endif /* _RaceCheckPoint_H__ */ |
---|