Changeset 7357 in orxonox.OLD for trunk/src/world_entities/spawning_point.h
- Timestamp:
- Apr 21, 2006, 11:45:52 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/spawning_point.h
r6512 r7357 13 13 class TiXmlElement; 14 14 15 //! The spawning point for world entities 15 16 //!< used to indicate what type of objects are spawned by this spawning point 17 typedef enum SpawningPointMode 18 { 19 SPT_ALL_AT_ONCE = 0, //!< at this spawning points there will be players spawned (typicaly in MP games) 20 SPT_ONE_AFTER_OTHER, //!< at this spawning points there will be NPS spawnded 21 22 SPT_NUMBER 23 }; 24 25 26 /** 27 * The spawning point for WorldEntities (and only WorldEntities) 28 * 29 * There are commonly two different spawning modes: 30 * 31 * 1) Just spawn whatever is in the queue with a given frequency (if delay = 0 => immediate spawn) 32 * 2) Spawn everything in the queue together with the given frequency 33 */ 16 34 class SpawningPoint : public WorldEntity { 17 35 18 36 public: 19 SpawningPoint ( World* world, const Vector& absCoordinate= Vector(0.0, 0.0, 0.0));20 SpawningPoint (const Vector& position, float frequency, float seed, ClassID classID, World* world);37 SpawningPoint (ClassID classID, const Vector& position = Vector(0.0, 0.0, 0.0)); 38 SpawningPoint (const Vector& position, ClassID classID, SpawningPointMode type, float delay); 21 39 virtual ~SpawningPoint (); 22 40 void init(); … … 27 45 void SpawningPoint::setSpawningEntity(ClassID classID) { this->classID = classID; } 28 46 /** sets the frequency with which the point is going to spawn entities (1/sec) @param frequency: the frequency */ 29 void SpawningPoint::setSpawning Frequency(float frequency) { this->frequency = frequency; }30 /** sets the seed of the position vector @param seed: the random seed around the given vector*/31 void SpawningPoint::set PositionSeed(float seed) { this->seed = seed; }47 void SpawningPoint::setSpawningDelay(float delay) { this->delay = delay; } 48 /** sets the spawning point mode @param mode: the mode */ 49 void SpawningPoint::setSpawningMode(int mode) { this->mode = (SpawningPointMode)mode; } 32 50 33 void spawn(); 51 52 /** activates the spawning point */ 53 void activate() { this->bSpawning = true; } 54 /** deactivates the spawning point */ 55 void deactivate() { this->bSpawning = false; } 56 34 57 35 58 virtual void tick(float dt); 36 59 virtual void draw(); 37 60 61 38 62 private: 39 float frequency; //!< the frequency for entity spawning 40 float countDown; //!< the timer that counts down until the next spawn 41 float seed; //!< the random seed of the position 42 ClassID classID; //!< the classid of the entity to spawn 43 World* world; //!< reference to the world it belongs to (or in the future: the object manager) 63 void spawn(); 44 64 65 66 private: 67 float delay; //!< the timer that counts down until the next spawn 68 float localTimer; //!< the local timer 69 float seed; //!< the random seed of the position 70 ClassID classID; //!< the classid of the entity to spawn 71 SpawningPointMode mode; //!< the mode of the spawning point 72 std::list<WorldEntity*> queue; //!< queue of waiting WorldEntities to be spawned 73 bool bSpawning; //!< flag to indicate if this spawning point is active or not 45 74 }; 46 75
Note: See TracChangeset
for help on using the changeset viewer.