- Timestamp:
- May 23, 2015, 7:33:37 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc
r10436 r10455 3 3 * 4 4 * Created on: Mar 26, 2015 5 * Author: meggiman5 * Author: Manuel Eggimann 6 6 */ 7 7 #include "GravityBomb.h" … … 12 12 RegisterClass(GravityBomb); 13 13 14 const float GravityBomb::LIFETIME = 5; 14 const float GravityBomb::LIFETIME = 5; ///< The gravity bomb lifetime in seconds. 15 15 16 16 GravityBomb::GravityBomb(Context* context): … … 41 41 rocketModel->scale(3.0f); 42 42 this->attach(rocketModel); 43 43 //Add second model because the bomb consists of the bomb and attached rockets (2 separate models) 44 44 Model* bombModel = new Model(this->getContext()); 45 45 bombModel->setMeshSource("GravityBomb.mesh"); //Demo Model from SimpleRocket … … 47 47 this->attach(bombModel); 48 48 49 //Add particle effect to the flying rockets. 50 ParticleEmitter* fire = new ParticleEmitter(this->getContext()); 51 fire->setOrientation(this->getOrientation()); 52 fire->setSource("Orxonox/simplerocketfire"); 53 this->attach(fire); 54 55 //Add sound effect while the bomb is flying. 56 WorldSound* bombSound = new WorldSound(context); 57 bombSound->setSource("sounds/GravityBombFlight.ogg"); 58 bombSound->setLooping(true); 59 bombSound->setVolume(1.0); 60 this->attach(bombSound); 61 bombSound->play(); 49 62 } 50 63 } … … 57 70 if(timeToLife_ < 0) 58 71 { 59 orxout(debug_output) << "bomb has stoped moving" <<endl; 60 setVelocity(Vector3::ZERO); 61 setAcceleration(Vector3::ZERO); 72 //orxout(debug_output) << "bomb has stoped moving" <<endl; 73 setVelocity(Vector3::ZERO); //Stop the bomb. 62 74 isDetonated_ = true; 63 75 } 64 76 else 65 77 { 66 orxout(debug_output)<< "Time to live:" << timeToLife_ <<endl;67 destroyCheck(); 78 //orxout(debug_output)<< "Time to live:" << timeToLife_ <<endl; 79 destroyCheck(); //Every BasicProjectil has to call this method in each tick. 68 80 } 69 81 if(isDetonated_) detonate(); … … 73 85 bool GravityBomb::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) 74 86 { 75 if(otherObject != getShooter()) 87 if(otherObject != getShooter()) //Ensure that the bomb cannot collide with its shooter. 76 88 { 77 89 orxout(debug_output) << "collides" << endl; … … 81 93 } 82 94 else{ 83 orxout(debug_output) << "collided with shooter. Has no effect..." << endl;95 //orxout(debug_output) << "collided with shooter. Has no effect..." << endl; 84 96 return false; 85 97 } … … 88 100 void GravityBomb::detonate() 89 101 { 102 //Create the GravityBombField and destroy the Projectil. 90 103 GravityBombField* field = new GravityBombField(this->getContext()); 91 104 field->setShooter(this->getShooter()); 92 105 field->setPosition(getPosition()); 93 orxout(debug_output) << "detonating. Creating GravityBombField." <<endl;94 orxout(debug_output) << "Field is at Position: " << getPosition() << endl;106 //orxout(debug_output) << "detonating. Creating GravityBombField." <<endl; 107 //orxout(debug_output) << "Field is at Position: " << getPosition() << endl; 95 108 this->destroy(); 96 109 }
Note: See TracChangeset
for help on using the changeset viewer.