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" |
---|
[9008] | 11 | #include <list> |
---|
[7400] | 12 | #include <vector> |
---|
[7017] | 13 | |
---|
[7483] | 14 | #include "kill.h" |
---|
[7017] | 15 | |
---|
[7020] | 16 | class TiXmlElement; |
---|
| 17 | class ObjectManager; |
---|
[7034] | 18 | class Player; |
---|
[7400] | 19 | class MissionGoal; |
---|
[7482] | 20 | class Kill; |
---|
[7017] | 21 | |
---|
| 22 | |
---|
[8623] | 23 | class GameRules : virtual public BaseObject |
---|
[7017] | 24 | { |
---|
[9869] | 25 | ObjectListDeclaration(GameRules); |
---|
[7017] | 26 | |
---|
| 27 | public: |
---|
[7035] | 28 | GameRules(const TiXmlElement* root); |
---|
[7017] | 29 | virtual ~GameRules(); |
---|
| 30 | |
---|
[7035] | 31 | virtual void loadParams(const TiXmlElement* root = NULL); |
---|
[7461] | 32 | void loadMissionGoal(const TiXmlElement* root = NULL); |
---|
[7020] | 33 | |
---|
| 34 | |
---|
[7400] | 35 | /** adding an mission goal to the game rules @param missionGoal the mission goal to add */ |
---|
| 36 | inline void addMissionGoal(MissionGoal* missionGoal) { this->missionList.push_back(missionGoal); } |
---|
[7486] | 37 | /** adding a kill event to the kill list @param kill the kill object containing all infos */ |
---|
[8362] | 38 | void registerKill(const Kill& kill); |
---|
[8802] | 39 | virtual void registerSpawn( WorldEntity * we ){} |
---|
[7400] | 40 | |
---|
[7044] | 41 | virtual void onPlayerSpawn() {} |
---|
| 42 | virtual void onPlayerDeath() {} |
---|
[7034] | 43 | |
---|
[7020] | 44 | virtual void tick(float dt) = 0; |
---|
[7034] | 45 | /** draws the stuff from the game rules if there is any need to */ |
---|
| 46 | void draw() {} |
---|
[7020] | 47 | |
---|
| 48 | |
---|
[7034] | 49 | protected: |
---|
| 50 | virtual void checkGameRules() {} |
---|
| 51 | |
---|
| 52 | |
---|
| 53 | protected: |
---|
[7400] | 54 | ObjectManager* pObjectManager; //!< reference to the current Object Manager |
---|
| 55 | Player* localPlayer; //!< reference to the local player |
---|
| 56 | std::vector<MissionGoal*> missionList; //!< list of mission goals |
---|
[7482] | 57 | |
---|
[9008] | 58 | std::list<Kill> killList; //!< list of kills in the world |
---|
[7020] | 59 | }; |
---|
[7017] | 60 | |
---|
[7020] | 61 | |
---|
| 62 | #endif /* _GAME_RULES_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.