Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7357 in orxonox.OLD for trunk/src/world_entities/spawning_point.cc


Ignore:
Timestamp:
Apr 21, 2006, 11:45:52 AM (19 years ago)
Author:
patrick
Message:

spawning point reviewed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/spawning_point.cc

    r7198 r7357  
    2424
    2525/**
    26  *  standard constructor
     26 *  constructor
    2727 */
    28 SpawningPoint::SpawningPoint (World* world, const Vector& absCoordinate)
     28SpawningPoint::SpawningPoint (ClassID classID, const Vector& position)
    2929{
    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;
    3334
    3435  this->init();
     
    3738
    3839/**
    39  *  constructor
     40 *  standard constructor
    4041 */
    41 SpawningPoint::SpawningPoint (const Vector& position, float frequency,
    42                               float seed, ClassID classID, World* world)
     42SpawningPoint::SpawningPoint (const Vector& position, ClassID classID, SpawningPointMode mode, float delay)
    4343{
    44   this->frequency = frequency;
    45   this->seed = seed;
     44  this->setAbsCoor(position);
    4645  this->classID = classID;
    47   this->world = world;
     46  this->mode = mode;
     47  this->delay = delay;
    4848
    4949  this->init();
     
    5151
    5252
     53
    5354void SpawningPoint::init()
    5455{
    55   this->countDown = 0.0f;
     56  this->setClassID(CL_SPAWNING_POINT, "SpawningPoint");
    5657}
    5758
     
    7475
    7576  /* 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");
    7979
    8080
    8181  /* 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");
    8584
    8685  /* now load the seed */
     
    9695void SpawningPoint::spawn()
    9796{
    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);
    101101
    102102//   if( likely(this->world != NULL))
     
    113113void SpawningPoint::tick(float dt)
    114114{
    115   this->countDown += dt;
    116   if( this->countDown > this->frequency)
     115  this->localTimer += dt;
     116  if( this->localTimer > this->delay)
    117117  {
    118118    this->spawn();
    119     this->countDown = 0.0f;
     119    this->localTimer = 0.0f;
    120120  }
    121121}
Note: See TracChangeset for help on using the changeset viewer.