Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

network: thown some old story entity functions away

File size: 3.0 KB
Line 
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...
15class StoryEntity : public BaseObject {
16
17 public:
18  StoryEntity ();
19  virtual ~StoryEntity ();
20
21  // INIT AND LOAD //
22  /** initializes a Story Entity to default Values */
23  virtual ErrorMessage init() {};
24  /** called before loading */
25  virtual ErrorMessage preLoad() {};
26  /** called to load. */
27  virtual ErrorMessage load() {};
28  /** called right after loading */
29  virtual ErrorMessage postLoad() {};
30  /** called after postload to check for integrity. (optional) */
31  virtual ErrorMessage check() {};
32
33  // RUNNING //
34  /** called shortly before starting the Entity */
35  virtual ErrorMessage preStart() {};
36  /** starts the Entity. Starts the main cycle */
37  virtual ErrorMessage start() = 0;
38  /** pauses the Entity. call to resume required to get it running again */
39  virtual ErrorMessage pause() = 0;
40  /** resumes the Entity after a stop/pause or suspend. */
41  virtual ErrorMessage resume() = 0;
42  /** suspends the Entity detaches all mayor functions  (optional) */
43  virtual ErrorMessage suspend() {};
44  /** rewinds to the beginning/last checkpoint */
45  virtual ErrorMessage rewind() {};
46  /** leaves the Entity. Ends it */
47  virtual ErrorMessage preStop() {};
48  /**  Stops the entity. */
49  virtual ErrorMessage stop() = 0;
50
51
52  /** sets the story id of the current entity, this enables it to be identified in a global context.  @param storyID the story id */
53  inline void setStoryID(int storyID) { this->storyID = storyID; }
54  /** sets the story id of the current entity, this enables it to be identified in a  global context. @returns  the story id  */
55  inline int getStoryID() { this->storyID = storyID; }
56  /**  sets the id of the next story entity: StoryEntities can choose their following entity themselfs.
57   * the entity id defined here  will be startet after this entity ends. this can be convenient if you
58   * want to have a non linear story with switches.
59   * @param nextStoryID the story id of the next StoryEntity   */
60  inline void setNextStoryID(int nextStoryID) { this->nextStoryID = nextStoryID; }
61  /**  gets the story id of the current entity @returns story id */
62  inline int getNextStoryID() { return this->nextStoryID; }
63
64
65
66  protected:
67    bool isInit;         //!< if the entity is initialized, this has to be true.
68    bool readyToRun;     //!< If the entity is ready to run -> post-check.
69    bool isPaused;       //!< is true if the entity is paused
70    bool isSuspended;    //!< if the Entity is suspended.
71
72 private:
73    int storyID;           //!< this is the number of this entity, identifying it in a list/tree...
74    int nextStoryID;       //!< if this entity has finished, this entity shall be called
75};
76
77#endif /* _STORY_ENTITY_H */
Note: See TracBrowser for help on using the repository browser.