Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/spawning_point.h @ 6792

Last change on this file since 6792 was 6512, checked in by bensch, 19 years ago

orxonox/trunk: loadParams is now virtual.
ALL THE CLASSES HAVE TO CALL

SuperClass::loadParams(root);

isntead of:
static_cast<SuperClass*>(this)→loadParams(root);

which was quite stupid anyways

File size: 1.8 KB
RevLine 
[6080]1/*!
2 * @file spawning_point.h
3 *  Definition of a spawning point within the game, used for network game
4 */
5
6
7#ifndef _SPAWNING_POINT
8#define _SPAWNING_POINT
9
10#include "world_entity.h"
11
[6083]12class World;
[6086]13class TiXmlElement;
[6083]14
[6080]15//! The spawning point for world entities
16class SpawningPoint : public WorldEntity {
17
18  public:
[6093]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);
[6080]21    virtual ~SpawningPoint ();
[6088]22    void init();
[6080]23
[6512]24    virtual void loadParams(const TiXmlElement* root);
[6086]25
[6081]26    /**  sets the entity that is going to be spawned by this point @param classID: the id from the class_id.h file */
[6093]27    void SpawningPoint::setSpawningEntity(ClassID classID) { this->classID = classID; }
[6081]28    /** sets the frequency with which the point is going to spawn entities (1/sec) @param frequency: the frequency */
29    void SpawningPoint::setSpawningFrequency(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::setPositionSeed(float seed) { this->seed = seed; }
32
[6080]33    void spawn();
34
35    virtual void tick(float dt);
36    virtual void draw();
37
38  private:
[6081]39    float                frequency;                      //!< the frequency for entity spawning
[6084]40    float                countDown;                      //!< the timer that counts down until the next spawn
[6081]41    float                seed;                           //!< the random seed of the position
[6093]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)
[6080]44
45};
46
47#endif /* _SPAWNING_POINT */
Note: See TracBrowser for help on using the repository browser.