Changeset 7357 in orxonox.OLD for trunk/src/world_entities/spawning_point.cc
- Timestamp:
- Apr 21, 2006, 11:45:52 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/spawning_point.cc
r7198 r7357 24 24 25 25 /** 26 * standardconstructor26 * constructor 27 27 */ 28 SpawningPoint::SpawningPoint ( World* world, const Vector& absCoordinate)28 SpawningPoint::SpawningPoint (ClassID classID, const Vector& position) 29 29 { 30 this->world = world; 31 this->frequency = 0.5f; 32 this->seed = 0.0f; 30 this->setAbsCoor(position); 31 this->classID = classID; 32 this->mode = SPT_ALL_AT_ONCE; 33 this->delay = 0; 33 34 34 35 this->init(); … … 37 38 38 39 /** 39 * constructor40 * standard constructor 40 41 */ 41 SpawningPoint::SpawningPoint (const Vector& position, float frequency, 42 float seed, ClassID classID, World* world) 42 SpawningPoint::SpawningPoint (const Vector& position, ClassID classID, SpawningPointMode mode, float delay) 43 43 { 44 this->frequency = frequency; 45 this->seed = seed; 44 this->setAbsCoor(position); 46 45 this->classID = classID; 47 this->world = world; 46 this->mode = mode; 47 this->delay = delay; 48 48 49 49 this->init(); … … 51 51 52 52 53 53 54 void SpawningPoint::init() 54 55 { 55 this-> countDown = 0.0f;56 this->setClassID(CL_SPAWNING_POINT, "SpawningPoint"); 56 57 } 57 58 … … 74 75 75 76 /* now load the frequency */ 76 LoadParam(root, "frequency", this, SpawningPoint, setSpawningFrequency) 77 .describe("sets the frequency of the spawning point") 78 .defaultValues(1.0f); 77 LoadParam(root, "delay", this, SpawningPoint, setSpawningDelay) 78 .describe("sets the delay of the spawning point"); 79 79 80 80 81 81 /* now load the seed */ 82 LoadParam(root, "randomseed", this, SpawningPoint, setPositionSeed) 83 .describe("sets the random position seed (variance in the spawning location around the position)") 84 .defaultValues(0.0f); 82 // LoadParam(root, "entity", this, SpawningPoint, setSpawningEntity) 83 // .describe("sets the spawning entity"); 85 84 86 85 /* now load the seed */ … … 96 95 void SpawningPoint::spawn() 97 96 { 98 PRINTF(5)("Spangingpoint creates a new Entity (id: %i, frequency: %f, seed: %f)\n", this->classID, 99 this->frequency, this->seed); 100 BaseObject* spawningEntity = Factory::fabricate(this->classID); 97 PRINTF(5)("Spangingpoint creates a new Entity (id: %i, delay: %f, mode: %f)\n", this->classID, 98 this->delay, this->mode); 99 100 //BaseObject* spawningEntity = Factory::fabricate(this->classID); 101 101 102 102 // if( likely(this->world != NULL)) … … 113 113 void SpawningPoint::tick(float dt) 114 114 { 115 this-> countDown+= dt;116 if( this-> countDown > this->frequency)115 this->localTimer += dt; 116 if( this->localTimer > this->delay) 117 117 { 118 118 this->spawn(); 119 this-> countDown= 0.0f;119 this->localTimer = 0.0f; 120 120 } 121 121 }
Note: See TracChangeset
for help on using the changeset viewer.