/*! * @file spawning_point.h * Definition of a spawning point within the game, used for network game */ #ifndef _SPAWNING_POINT #define _SPAWNING_POINT #include "world_entity.h" class World; class TiXmlElement; //! The spawning point for world entities class SpawningPoint : public WorldEntity { public: SpawningPoint (const Vector& absCoordinate = Vector(0.0, 0.0, 0.0), const World* world); SpawningPoint (const Vector& position, float frequency, float seed, int classID, const World* world); virtual ~SpawningPoint (); void loadParams(const TiXmlElement* root); void setSpawningEntity(int classID); void setSpawningFrequency(float frequency); void setPositionSeed(float seed); /** sets the entity that is going to be spawned by this point @param classID: the id from the class_id.h file */ void SpawningPoint::setSpawningEntity(int classID) { this->classID = classID; } /** sets the frequency with which the point is going to spawn entities (1/sec) @param frequency: the frequency */ void SpawningPoint::setSpawningFrequency(float frequency) { this->frequency = frequency; } /** sets the seed of the position vector @param seed: the random seed around the given vector */ void SpawningPoint::setPositionSeed(float seed) { this->seed = seed; } void spawn(); virtual void tick(float dt); virtual void draw(); private: float frequency; //!< the frequency for entity spawning float countDown; //!< the timer that counts down until the next spawn float seed; //!< the random seed of the position int classID; //!< the classid of the entity to spawn }; #endif /* _SPAWNING_POINT */