Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/gui/src/util/game_rules.h @ 7900

Last change on this file since 7900 was 7488, checked in by patrick, 19 years ago

orxonox: mission manager less verbose and more secure now

File size: 1.5 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#include "kill.h"
14
15class TiXmlElement;
16class ObjectManager;
17class Player;
18class MissionGoal;
19class Kill;
20
21
22class GameRules : public BaseObject
23{
24
25  public:
26    GameRules(const TiXmlElement* root);
27    virtual ~GameRules();
28
29    virtual void loadParams(const TiXmlElement* root = NULL);
30    void loadMissionGoal(const TiXmlElement* root = NULL);
31
32
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); }
35    /** adding a kill event to the kill list @param kill the kill object containing all infos */
36    inline void registerKill(const Kill& kill) { PRINTF(0)("Received Event: Kill\n"); this->killList.push_back(kill); }
37
38    virtual void onPlayerSpawn() {}
39    virtual void onPlayerDeath() {}
40
41
42    virtual void tick(float dt) = 0;
43    /** draws the stuff from the game rules if there is any need to */
44    void draw() {}
45
46
47  protected:
48    virtual void checkGameRules() {}
49
50
51  protected:
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
55
56    std::vector<Kill>          killList;               //!<  list of kills in the world
57};
58
59
60#endif /* _GAME_RULES_H */
Note: See TracBrowser for help on using the repository browser.