[8494] | 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 | |
---|
[8639] | 32 | #include "gametypes/GametypesPrereqs.h" |
---|
[9016] | 33 | #include "objects/triggers/DistanceMultiTrigger.h" |
---|
[8494] | 34 | #include "interfaces/RadarViewable.h" |
---|
| 35 | |
---|
| 36 | namespace orxonox |
---|
| 37 | { |
---|
[8767] | 38 | /** |
---|
| 39 | @brief |
---|
| 40 | The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level. |
---|
[9260] | 41 | Don't forget to control the indexes of your check points and to set one last check point |
---|
[8767] | 42 | */ |
---|
[9016] | 43 | class _GametypesExport RaceCheckPoint : public DistanceMultiTrigger, public RadarViewable |
---|
[8494] | 44 | { |
---|
[8630] | 45 | public: |
---|
| 46 | RaceCheckPoint(BaseObject* creator); |
---|
| 47 | virtual ~RaceCheckPoint(); |
---|
| 48 | |
---|
| 49 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
---|
[9260] | 50 | |
---|
[9016] | 51 | inline void setCheckpointIndex(int checkpointIndex) |
---|
[9260] | 52 | { this->checkpointIndex_ = checkpointIndex; } |
---|
| 53 | inline int getCheckpointIndex() const |
---|
| 54 | { return this->checkpointIndex_; } |
---|
[8630] | 55 | |
---|
[9016] | 56 | inline void setNextcheckpoint(const Vector3& checkpoints) |
---|
[9260] | 57 | { this->nextcheckpoints_ = checkpoints; } |
---|
[9016] | 58 | inline void setNextcheckpoint(float x, float y, float z) |
---|
| 59 | { this->setNextcheckpoint(Vector3(x, y, z)); } |
---|
| 60 | inline const Vector3& getNextcheckpoint() const |
---|
| 61 | { return this->nextcheckpoints_; } |
---|
[9260] | 62 | |
---|
[8630] | 63 | inline void setLast(bool isLast) |
---|
| 64 | { this->bIsLast_ = isLast; } |
---|
[9260] | 65 | inline bool isLast() const |
---|
[8630] | 66 | { return this->bIsLast_; } |
---|
[9016] | 67 | |
---|
[9260] | 68 | virtual void setTimelimit(float timeLimit); |
---|
| 69 | inline float getTimeLimit() const |
---|
| 70 | { return this->timeLimit_; } |
---|
| 71 | |
---|
| 72 | inline PlayerInfo* getPlayer() const |
---|
| 73 | { return this->player_; } |
---|
| 74 | inline void resetPlayer() |
---|
| 75 | { this->player_ = NULL; } |
---|
| 76 | |
---|
[9016] | 77 | protected: |
---|
[9260] | 78 | virtual void fire(bool bIsTriggered, BaseObject* originator); |
---|
| 79 | |
---|
[8630] | 80 | inline const WorldEntity* getWorldEntity() const |
---|
| 81 | { return this; } |
---|
| 82 | |
---|
| 83 | private: |
---|
[9260] | 84 | int checkpointIndex_; ///< The index of this check point. The race starts with the check point with the index 0 |
---|
| 85 | Vector3 nextcheckpoints_; ///< the indexes of the next check points |
---|
| 86 | 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. |
---|
| 87 | float timeLimit_; ///< 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. |
---|
| 88 | PlayerInfo* player_; ///< The player that reached the checkpoint |
---|
[8494] | 89 | }; |
---|
| 90 | } |
---|
| 91 | |
---|
[9016] | 92 | #endif /* _RaceCheckPoint_H__ */ |
---|