1 | /*! |
---|
2 | * @file story_entity.h |
---|
3 | * holds the base class of everything that is playable - that is part of the story |
---|
4 | */ |
---|
5 | |
---|
6 | |
---|
7 | #ifndef _STORY_ENTITY_H |
---|
8 | #define _STORY_ENTITY_H |
---|
9 | |
---|
10 | #include "base_object.h" |
---|
11 | #include "story_def.h" |
---|
12 | #include "error.h" |
---|
13 | |
---|
14 | //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc... |
---|
15 | class StoryEntity : public BaseObject { |
---|
16 | |
---|
17 | public: |
---|
18 | StoryEntity (); |
---|
19 | virtual ~StoryEntity (); |
---|
20 | |
---|
21 | // INIT AND LOAD // |
---|
22 | /** @brief initializes a Story Entity to default Values */ |
---|
23 | virtual ErrorMessage init() {}; |
---|
24 | /** @brief called before loading */ |
---|
25 | virtual ErrorMessage preLoad() {}; |
---|
26 | /** @brief called to load. */ |
---|
27 | virtual ErrorMessage load() {}; |
---|
28 | /** @brief called right after loading */ |
---|
29 | virtual ErrorMessage postLoad() {}; |
---|
30 | /** @brief called after postload to check for integrity. (optional) */ |
---|
31 | virtual ErrorMessage check() {}; |
---|
32 | |
---|
33 | // RUNNING // |
---|
34 | /** @brief called shortly before starting the Entity */ |
---|
35 | virtual ErrorMessage preStart() {}; |
---|
36 | /** @brief starts the Entity. Starts the main cycle */ |
---|
37 | virtual ErrorMessage start() = 0; |
---|
38 | /** @brief pauses the Entity. call to resume required to get it running again */ |
---|
39 | virtual ErrorMessage pause() = 0; |
---|
40 | /** @brief resumes the Entity after a stop/pause or suspend. */ |
---|
41 | virtual ErrorMessage resume() = 0; |
---|
42 | /** @brief suspends the Entity detaches all mayor functions (optional) */ |
---|
43 | virtual ErrorMessage suspend() {}; |
---|
44 | /** @brief rewinds to the beginning/last checkpoint */ |
---|
45 | virtual ErrorMessage rewind() {}; |
---|
46 | /** @brief leaves the Entity. Ends it */ |
---|
47 | virtual ErrorMessage preStop() {}; |
---|
48 | /** @brief Stops the entity. */ |
---|
49 | virtual ErrorMessage stop() = 0; |
---|
50 | |
---|
51 | // KILLING |
---|
52 | /** @brief kills the Entity. should also calls prestop stop */ |
---|
53 | virtual ErrorMessage destroy() {}; |
---|
54 | |
---|
55 | void setStoryID(int storyID); |
---|
56 | int getStoryID(); |
---|
57 | |
---|
58 | void setNextStoryID(int nextStoryID); |
---|
59 | int getNextStoryID(); |
---|
60 | |
---|
61 | protected: |
---|
62 | bool isInit; //!< if the entity is initialized, this has to be true. |
---|
63 | bool readyToRun; //!< If the entity is ready to run -> post-check. |
---|
64 | bool isPaused; //!< is true if the entity is paused |
---|
65 | bool isSuspended; //!< if the Entity is suspended. |
---|
66 | |
---|
67 | private: |
---|
68 | int storyID; //!< this is the number of this entity, identifying it in a list/tree... |
---|
69 | int nextStoryID; //!< if this entity has finished, this entity shall be called |
---|
70 | }; |
---|
71 | |
---|
72 | #endif /* _STORY_ENTITY_H */ |
---|