Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/story_entities/story_entity.h @ 6387

Last change on this file since 6387 was 6387, checked in by patrick, 18 years ago

network: much more work on the StoryEntity functions and reimplementations of the DataTanks of each StoryEntity

File size: 2.8 KB
RevLine 
[4597]1/*!
[5039]2 * @file story_entity.h
[6386]3 *  holds the base class of everything that is playable - that is part of the story
4 */
[2636]5
[3221]6
[3224]7#ifndef _STORY_ENTITY_H
8#define _STORY_ENTITY_H
[2636]9
[3608]10#include "base_object.h"
[2636]11#include "story_def.h"
[3608]12#include "error.h"
[2636]13
[6387]14
15typedef enum StoryEntityState
16{
17  SE_STATE_RUN     = 0,
18  SE_STATE_STOP,
19  SE_STATE_PAUSE,
20
21  SE_STATE_NUM
22};
23
24
[3221]25//! A class that represents something to play in orxonox. it is a container for worlds, movies, mission briefings, etc...
[3365]26class StoryEntity : public BaseObject {
[2636]27
28 public:
29  StoryEntity ();
[3221]30  virtual ~StoryEntity ();
[2636]31
[6374]32  void loadParams(const TiXmlElement* root);
33
[6372]34  /* initialisation and loading */
35  /** initializes a Story Entity to the needed values */
[6153]36  virtual ErrorMessage init() {};
[6386]37  /** called to load the data into the StoryEntity*/
[6372]38  virtual ErrorMessage loadData() {};
[6386]39  /** function that unloads the data from the StoryEntity */
40  virtual ErrorMessage unloadData() {};
[6387]41
[6372]42  /* running, stopping and pausing */
[6371]43  /** starts the Entity. Starts the main cycle */
[6387]44  virtual bool start() = 0;
[6371]45  /**  Stops the entity. */
[6387]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;
[6153]53
[6387]54  /* properties interface */
55  /** returns the state of this StoryEntity */
56  StoryEntityState getState();
[2636]57
[6371]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  */
[6374]61  inline int getStoryID() { return this->storyID; }
[6371]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; }
[2636]69
70
[6371]71
[6152]72  protected:
73    bool isInit;         //!< if the entity is initialized, this has to be true.
[6386]74    bool isRunning;      //!< is true if the entity is running
[6152]75    bool isPaused;       //!< is true if the entity is paused
[2636]76
[6377]77
[2636]78 private:
[6153]79    int storyID;           //!< this is the number of this entity, identifying it in a list/tree...
80    int nextStoryID;       //!< if this entity has finished, this entity shall be called
[2636]81};
82
[3224]83#endif /* _STORY_ENTITY_H */
Note: See TracBrowser for help on using the repository browser.