Changeset 10409
- Timestamp:
- Apr 30, 2015, 4:47:36 PM (10 years ago)
- Location:
- code/branches/weaponFS15/src/modules/weapons/projectiles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.cc
r10391 r10409 12 12 RegisterClass(GravityBombField); 13 13 14 const float GravityBombField::FORCE_FIELD_LIFETIME = 100;15 const float GravityBombField::FORCE_SPHERE_START_RADIUS = 500;14 const float GravityBombField::FORCE_FIELD_LIFETIME = 20; 15 const float GravityBombField::FORCE_SPHERE_START_RADIUS = 250; 16 16 const float GravityBombField::FORCE_SPHERE_START_STRENGTH = -500; 17 17 18 GravityBombField::GravityBombField(Context* context) : ForceField(context) 18 GravityBombField::GravityBombField(Context* context) : ForceField(context),RadarViewable(this, static_cast<WorldEntity*>(this)) 19 19 { 20 20 RegisterObject(GravityBombField); 21 21 lifetime_=FORCE_FIELD_LIFETIME; 22 forceStrength_ = FORCE_SPHERE_START_STRENGTH; 23 forceSphereRadius_ = FORCE_SPHERE_START_RADIUS; 24 fieldExploded_ = false; 25 22 26 setVelocity(FORCE_SPHERE_START_STRENGTH); 23 setDiameter( FORCE_SPHERE_START_RADIUS);24 setMode(mode InvertedSphere_s);27 setDiameter(2*FORCE_SPHERE_START_RADIUS); 28 setMode(modeSphere_s); 25 29 setCollisionResponse(false); 30 31 this->setRadarObjectColour(ColourValue(0.2, 0.2, 1.0,1)); // Blue 32 this->setRadarObjectShape(RadarViewable::Dot); 33 this->setRadarObjectScale(0.5f); 26 34 27 35 //Attach Demo Model for debuging. … … 30 38 model->scale(0.7f); 31 39 this->attach(model); 40 41 this->particleSphere_ = new ParticleEmitter(this->getContext()); 42 this->attach(this->particleSphere_); 43 44 particleSphere_->setSource("Orxonox/GravityBombField"); 32 45 } 33 46 … … 38 51 SUPER(GravityBombField,tick,dt); 39 52 lifetime_-=dt; 53 forceStrength_ *= (1+dt/10); 54 if(lifetime_ < 0.2 && !fieldExploded_) 55 { 56 forceStrength_ *= -2; 57 forceSphereRadius_ *= 2; 58 fieldExploded_ = true; 59 orxout(debug_output) << "Field exploded. Inverting Force." << endl; 60 } 61 62 setDiameter(forceSphereRadius_*2); 63 setVelocity(forceStrength_); 64 40 65 if(lifetime_ < 0) 41 66 { -
code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.h
r10341 r10409 16 16 #include "core/CoreIncludes.h" 17 17 #include "GravityBomb.h" 18 #include "graphics/ParticleSpawner.h" 19 18 20 19 21 namespace orxonox { 20 class GravityBombField: public ForceField {22 class GravityBombField: public ForceField, public RadarViewable { 21 23 public: 22 24 GravityBombField(Context* context); … … 32 34 float forceStrength_; 33 35 float lifetime_; 36 bool fieldExploded_; 37 ParticleEmitter * particleSphere_; 34 38 35 39 };
Note: See TracChangeset
for help on using the changeset viewer.