/*! * @file story_entity.h * holds the base class of everything that is playable - that is part of the story */ #ifndef _STORY_ENTITY_H #define _STORY_ENTITY_H #include "base_object.h" #include "story_def.h" #include "error.h" //! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc... class StoryEntity : public BaseObject { public: StoryEntity (); virtual ~StoryEntity (); // INIT AND LOAD // /** @brief initializes a Story Entity to default Values */ virtual ErrorMessage init() {}; /** @brief called before loading */ virtual ErrorMessage preLoad() {}; /** @brief called to load. */ virtual ErrorMessage load() {}; /** @brief called right after loading */ virtual ErrorMessage postLoad() {}; /** @brief called after postload to check for integrity. (optional) */ virtual ErrorMessage check() {}; // RUNNING // /** @brief called shortly before starting the Entity */ virtual ErrorMessage preStart() {}; /** @brief starts the Entity. Starts the main cycle */ virtual ErrorMessage start() = 0; /** @brief pauses the Entity. call to resume required to get it running again */ virtual ErrorMessage pause() = 0; /** @brief resumes the Entity after a stop/pause or suspend. */ virtual ErrorMessage resume() = 0; /** @brief suspends the Entity detaches all mayor functions (optional) */ virtual ErrorMessage suspend() {}; /** @brief rewinds to the beginning/last checkpoint */ virtual ErrorMessage rewind() {}; /** @brief leaves the Entity. Ends it */ virtual ErrorMessage preStop() {}; /** @brief Stops the entity. */ virtual ErrorMessage stop() = 0; // KILLING /** @brief kills the Entity. should also calls prestop stop */ virtual ErrorMessage destroy() {}; void setStoryID(int storyID); int getStoryID(); void setNextStoryID(int nextStoryID); int getNextStoryID(); protected: bool isInit; //!< if the entity is initialized, this has to be true. bool readyToRun; //!< If the entity is ready to run -> post-check. bool isPaused; //!< is true if the entity is paused bool isSuspended; //!< if the Entity is suspended. private: int storyID; //!< this is the number of this entity, identifying it in a list/tree... int nextStoryID; //!< if this entity has finished, this entity shall be called }; #endif /* _STORY_ENTITY_H */