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