| 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 | |
|---|
| 12 | |
|---|
| 13 | class TiXmlElement; |
|---|
| 14 | class ObjectManager; |
|---|
| 15 | class Player; |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | class GameRules : public BaseObject |
|---|
| 19 | { |
|---|
| 20 | |
|---|
| 21 | public: |
|---|
| 22 | GameRules(const TiXmlElement* root); |
|---|
| 23 | virtual ~GameRules(); |
|---|
| 24 | |
|---|
| 25 | virtual void loadParams(const TiXmlElement* root = NULL); |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | virtual void onPlayerSpawn() {} |
|---|
| 29 | virtual void onPlayerDeath() {} |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | virtual void tick(float dt) = 0; |
|---|
| 33 | /** draws the stuff from the game rules if there is any need to */ |
|---|
| 34 | void draw() {} |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | protected: |
|---|
| 38 | virtual void checkGameRules() {} |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | protected: |
|---|
| 42 | ObjectManager* pObjectManager; //!< reference to the current Object Manager |
|---|
| 43 | Player* localPlayer; //!< reference to the local player |
|---|
| 44 | }; |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | #endif /* _GAME_RULES_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.