Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 2, 2006, 10:20:16 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: added powerups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/power_ups/power_up.cc

    r6815 r6973  
    2121#include "primitive_model.h"
    2222
    23 #include "assert.h"
     23#include "load_param.h"
    2424
    2525using namespace std;
     
    2929  this->setClassID(CL_POWER_UP, "PowerUp");
    3030
    31   this->respawnType = RESPAWN_NONE;
     31  this->respawnType = RESPAWN_TIME;
    3232  this->respawnStart = 10;
    3333  this->model = NULL;
     
    3939  this->buildObbTree( 4);
    4040  this->sphereMaterial = new Material;
    41   this->sphereMaterial->setTransparency(.1);
     41  this->sphereMaterial->setTransparency(.8);
    4242  this->sphereMaterial->setDiffuse(r, g, b);
    4343  this->toList(OM_COMMON);
     
    5353{
    5454  WorldEntity::loadParams(root);
     55  LoadParam(root, "respawnType", this, PowerUp, setRespawnType);
     56  LoadParam(root, "respawnTime", this, PowerUp, setRespawnTime);
    5557}
    5658
     
    6264    if(dynamic_cast<Extendable*>(entity)->pickup(this))
    6365    {
    64       this->respawnTime = this->respawnStart;
    65       this->toList(OM_DEAD_TICK);
     66      switch(respawnType) {
     67        case RESPAWN_NONE:
     68          this->toList(OM_DEAD);
     69          break;
     70        case RESPAWN_TIME:
     71          this->toList(OM_DEAD_TICK);
     72          this->respawnTime = this->respawnStart;
     73          break;
     74      }
    6675    }
    6776  }
     
    7281    this->respawnTime -= dt;
    7382    if(this->respawnTime <= 0) {
    74       this->respawn();
    7583      this->toList(OM_COMMON);
    7684    }
     
    110118}
    111119
     120void PowerUp::setRespawnTime(const float respawnTime)
     121{
     122  this->respawnStart = respawnTime;
     123}
    112124
    113125
Note: See TracChangeset for help on using the changeset viewer.