Changeset 6424 in orxonox.OLD for trunk/src/story_entities/story_entity.h
- Timestamp:
- Jan 7, 2006, 11:07:22 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/story_entities/story_entity.h
r6153 r6424 1 1 /*! 2 2 * @file story_entity.h 3 4 */3 * holds the base class of everything that is playable - that is part of the story 4 */ 5 5 6 6 … … 12 12 #include "error.h" 13 13 14 15 typedef enum StoryEntityState 16 { 17 SE_STATE_RUN = 0, 18 SE_STATE_STOP, 19 SE_STATE_PAUSE, 20 21 SE_STATE_NUM 22 }; 23 24 14 25 //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc... 15 26 class StoryEntity : public BaseObject { … … 19 30 virtual ~StoryEntity (); 20 31 21 // INIT AND LOAD // 22 /** @brief initializes a Story Entity to default Values */ 32 void loadParams(const TiXmlElement* root); 33 34 /* initialisation and loading */ 35 /** initializes a Story Entity to the needed values */ 23 36 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() {}; 37 /** called to load the data into the StoryEntity*/ 38 virtual ErrorMessage loadData() {}; 39 /** function that unloads the data from the StoryEntity */ 40 virtual ErrorMessage unloadData() {}; 32 41 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; 42 /* running, stopping and pausing */ 43 /** starts the Entity. Starts the main cycle */ 44 virtual bool start() = 0; 45 /** Stops the entity. */ 46 virtual bool stop() = 0; 47 /** pauses the Entity, you can resume the game by calling the resume() function */ 48 virtual bool pause() = 0; 49 /** resumes a paused StoryEntity */ 50 virtual bool resume() = 0; 51 /** function that is been called when the StoryEntity is started via start() */ 52 virtual void run() = 0; 50 53 51 / / KILLING52 /** @brief kills the Entity. should also calls prestop stop*/53 virtual ErrorMessage destroy() {};54 /* properties interface */ 55 /** returns the state of this StoryEntity */ 56 StoryEntityState getState(); 54 57 55 void setStoryID(int storyID); 56 int getStoryID(); 58 /** sets the story id of the current entity, this enables it to be identified in a global context. @param storyID the story id */ 59 inline void setStoryID(int storyID) { this->storyID = storyID; } 60 /** sets the story id of the current entity, this enables it to be identified in a global context. @returns the story id */ 61 inline int getStoryID() { return this->storyID; } 62 /** sets the id of the next story entity: StoryEntities can choose their following entity themselfs. 63 * the entity id defined here will be startet after this entity ends. this can be convenient if you 64 * want to have a non linear story with switches. 65 * @param nextStoryID the story id of the next StoryEntity */ 66 inline void setNextStoryID(int nextStoryID) { this->nextStoryID = nextStoryID; } 67 /** gets the story id of the current entity @returns story id */ 68 inline int getNextStoryID() { return this->nextStoryID; } 57 69 58 void setNextStoryID(int nextStoryID); 59 int getNextStoryID(); 70 60 71 61 72 protected: 62 73 bool isInit; //!< if the entity is initialized, this has to be true. 63 bool readyToRun; //!< If the entity is ready to run -> post-check.74 bool isRunning; //!< is true if the entity is running 64 75 bool isPaused; //!< is true if the entity is paused 65 bool isSuspended; //!< if the Entity is suspended. 76 66 77 67 78 private:
Note: See TracChangeset
for help on using the changeset viewer.