| 
                Last change
                  on this file since 7509 was
                  7400,
                  checked in by patrick, 20 years ago
           | 
        
        
          | 
               
worked on game rules and mission goals 
 
           | 
        
        | 
            File size:
            1.2 KB
           | 
      
      
        
  | 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 <vector> | 
|---|
| 12 |  | 
|---|
| 13 |  | 
|---|
| 14 | class TiXmlElement; | 
|---|
| 15 | class ObjectManager; | 
|---|
| 16 | class Player; | 
|---|
| 17 | class MissionGoal; | 
|---|
| 18 |  | 
|---|
| 19 |  | 
|---|
| 20 | class GameRules : public BaseObject | 
|---|
| 21 | { | 
|---|
| 22 |  | 
|---|
| 23 |   public: | 
|---|
| 24 |     GameRules(const TiXmlElement* root); | 
|---|
| 25 |     virtual ~GameRules(); | 
|---|
| 26 |  | 
|---|
| 27 |     virtual void loadParams(const TiXmlElement* root = NULL); | 
|---|
| 28 |  | 
|---|
| 29 |  | 
|---|
| 30 |     /** adding an mission goal to the game rules @param missionGoal the mission goal to add */ | 
|---|
| 31 |     inline void addMissionGoal(MissionGoal* missionGoal) { this->missionList.push_back(missionGoal); } | 
|---|
| 32 |  | 
|---|
| 33 |  | 
|---|
| 34 |     virtual void onPlayerSpawn() {} | 
|---|
| 35 |     virtual void onPlayerDeath() {} | 
|---|
| 36 |  | 
|---|
| 37 |  | 
|---|
| 38 |     virtual void tick(float dt) = 0; | 
|---|
| 39 |     /** draws the stuff from the game rules if there is any need to */ | 
|---|
| 40 |     void draw() {} | 
|---|
| 41 |  | 
|---|
| 42 |  | 
|---|
| 43 |   protected: | 
|---|
| 44 |     virtual void checkGameRules() {} | 
|---|
| 45 |  | 
|---|
| 46 |  | 
|---|
| 47 |   protected: | 
|---|
| 48 |     ObjectManager*              pObjectManager;         //!< reference to the current Object Manager | 
|---|
| 49 |     Player*                     localPlayer;            //!< reference to the local player | 
|---|
| 50 |     std::vector<MissionGoal*>   missionList;            //!< list of mission goals | 
|---|
| 51 | }; | 
|---|
| 52 |  | 
|---|
| 53 |  | 
|---|
| 54 | #endif /* _GAME_RULES_H */ | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.