Last change
on this file since 8110 was
7488,
checked in by patrick, 19 years ago
|
orxonox: mission manager less verbose and more secure now
|
File size:
1.5 KB
|
Rev | Line | |
---|
[7017] | 1 | |
---|
| 2 | /*! |
---|
| 3 | * @file game_rules.h |
---|
| 4 | * Defines game rules for this game |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #ifndef _GAME_RULES_H |
---|
| 8 | #define _GAME_RULES_H |
---|
| 9 | |
---|
| 10 | #include "base_object.h" |
---|
[7400] | 11 | #include <vector> |
---|
[7017] | 12 | |
---|
[7483] | 13 | #include "kill.h" |
---|
[7017] | 14 | |
---|
[7020] | 15 | class TiXmlElement; |
---|
| 16 | class ObjectManager; |
---|
[7034] | 17 | class Player; |
---|
[7400] | 18 | class MissionGoal; |
---|
[7482] | 19 | class Kill; |
---|
[7017] | 20 | |
---|
| 21 | |
---|
| 22 | class GameRules : public BaseObject |
---|
| 23 | { |
---|
| 24 | |
---|
| 25 | public: |
---|
[7035] | 26 | GameRules(const TiXmlElement* root); |
---|
[7017] | 27 | virtual ~GameRules(); |
---|
| 28 | |
---|
[7035] | 29 | virtual void loadParams(const TiXmlElement* root = NULL); |
---|
[7461] | 30 | void loadMissionGoal(const TiXmlElement* root = NULL); |
---|
[7020] | 31 | |
---|
| 32 | |
---|
[7400] | 33 | /** adding an mission goal to the game rules @param missionGoal the mission goal to add */ |
---|
| 34 | inline void addMissionGoal(MissionGoal* missionGoal) { this->missionList.push_back(missionGoal); } |
---|
[7486] | 35 | /** adding a kill event to the kill list @param kill the kill object containing all infos */ |
---|
[7488] | 36 | inline void registerKill(const Kill& kill) { PRINTF(0)("Received Event: Kill\n"); this->killList.push_back(kill); } |
---|
[7400] | 37 | |
---|
[7044] | 38 | virtual void onPlayerSpawn() {} |
---|
| 39 | virtual void onPlayerDeath() {} |
---|
[7034] | 40 | |
---|
| 41 | |
---|
[7020] | 42 | virtual void tick(float dt) = 0; |
---|
[7034] | 43 | /** draws the stuff from the game rules if there is any need to */ |
---|
| 44 | void draw() {} |
---|
[7020] | 45 | |
---|
| 46 | |
---|
[7034] | 47 | protected: |
---|
| 48 | virtual void checkGameRules() {} |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | protected: |
---|
[7400] | 52 | ObjectManager* pObjectManager; //!< reference to the current Object Manager |
---|
| 53 | Player* localPlayer; //!< reference to the local player |
---|
| 54 | std::vector<MissionGoal*> missionList; //!< list of mission goals |
---|
[7482] | 55 | |
---|
[7486] | 56 | std::vector<Kill> killList; //!< list of kills in the world |
---|
[7020] | 57 | }; |
---|
[7017] | 58 | |
---|
[7020] | 59 | |
---|
| 60 | #endif /* _GAME_RULES_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.