Changeset 10502
- Timestamp:
- May 27, 2015, 4:23:44 PM (10 years ago)
- Location:
- code/branches/weaponFS15/src/modules/weapons/projectiles
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc
r10455 r10502 12 12 RegisterClass(GravityBomb); 13 13 14 const float GravityBomb::LIFETIME = 5; ///< The gravity bomb lifetime in seconds.14 const float GravityBomb::LIFETIME = 2.5; ///< The gravity bomb lifetime in seconds. 15 15 16 16 GravityBomb::GravityBomb(Context* context): … … 22 22 23 23 this->setMass(10.0); 24 this-> isDetonated_ = false;24 this->hasCollided_ = false; 25 25 if (GameMode::isMaster()) 26 26 { … … 67 67 void GravityBomb::tick(float dt) 68 68 { 69 timeToLife_ -= dt;70 if(timeToLife_ < 0)71 {72 //orxout(debug_output) << "bomb has stoped moving" <<endl;73 setVelocity(Vector3::ZERO); //Stop the bomb.74 isDetonated_ = true;75 }76 else77 {78 //orxout(debug_output)<< "Time to live:" << timeToLife_ <<endl;79 destroyCheck(); //Every BasicProjectil has to call this method in each tick.80 }81 if(isDetonated_) detonate();82 else SUPER(GravityBomb, tick, dt);69 SUPER(GravityBomb, tick, dt); 70 timeToLife_ -= dt; 71 if (timeToLife_ < 0) 72 { 73 //orxout(debug_output) << "bomb has stoped moving" <<endl; 74 setVelocity(Vector3::ZERO); //Stop the bomb. 75 detonate(); 76 this->destroy(); 77 } 78 else 79 { 80 if (hasCollided_) detonate(); 81 destroyCheck(); //Bomb is going to be destroyed by destroyCheck(). As written in BasicProectile, this Method should be called by every Projectile. 82 } 83 83 } 84 84 85 85 bool GravityBomb::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) 86 86 { 87 if(otherObject != getShooter()) //Ensure that the bomb cannot collide with its shooter. 88 { 89 orxout(debug_output) << "collides" << endl; 90 processCollision(otherObject, contactPoint,cs); 91 isDetonated_ = true; 92 return true; 93 } 94 else{ 95 //orxout(debug_output) << "collided with shooter. Has no effect..." << endl; 96 return false; 97 } 87 hasCollided_ = processCollision(otherObject, contactPoint, cs); 88 return hasCollided_; 98 89 } 99 90 … … 106 97 //orxout(debug_output) << "detonating. Creating GravityBombField." <<endl; 107 98 //orxout(debug_output) << "Field is at Position: " << getPosition() << endl; 108 this->destroy();109 99 } 110 100 } -
code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.h
r10455 r10502 48 48 static const float LIFETIME; 49 49 50 bool isDetonated_; //Used to check whether the Bomb has to be destroyed during next tick.50 bool hasCollided_; 51 51 float timeToLife_; //Time the bomb flies before it explodes. 52 52 WorldSound* bombSound_; -
code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.cc
r10455 r10502 16 16 const float GravityBombField::FORCE_FIELD_LIFETIME = 15; 17 17 const float GravityBombField::FORCE_SPHERE_START_RADIUS = 250; 18 const float GravityBombField::FORCE_SPHERE_START_STRENGTH = - 500;18 const float GravityBombField::FORCE_SPHERE_START_STRENGTH = -700; 19 19 const float GravityBombField::PEAK_EXPLOSION_FORCE = 5e4; 20 20 const float GravityBombField::FORCE_FIELD_EXPLOSION_DAMMAGE = 100; … … 40 40 41 41 //Make the Field visible on Radar and minimap. 42 this->setRadarObjectColour(ColourValue( 0.2, 0.2, 1.0,1)); // Blue42 this->setRadarObjectColour(ColourValue(1.0, 0.0, 0.2,1)); // Red 43 43 this->setRadarObjectShape(RadarViewable::Dot); 44 this->setRadarObjectScale( 0.5f);44 this->setRadarObjectScale(1.0f); 45 45 46 46
Note: See TracChangeset
for help on using the changeset viewer.