[Orxonox-commit 5795] r10455 - in code/branches/weaponFS15/src/modules/weapons: munitions projectiles weaponmodes
meggiman at orxonox.net
meggiman at orxonox.net
Sat May 23 19:33:37 CEST 2015
Author: meggiman
Date: 2015-05-23 19:33:37 +0200 (Sat, 23 May 2015)
New Revision: 10455
Modified:
code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.cc
code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.h
code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc
code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.h
code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.cc
code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.h
code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.cc
code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.h
Log:
Modified: code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.cc
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.cc 2015-05-22 09:06:11 UTC (rev 10454)
+++ code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.cc 2015-05-23 17:33:37 UTC (rev 10455)
@@ -2,7 +2,7 @@
* GravityBombMunition.cc
*
* Created on: Apr 16, 2015
- * Author: meggiman
+ * Author: Manuel Eggimann
*/
#include "GravityBombMunition.h"
#include "core/CoreIncludes.h"
@@ -16,7 +16,7 @@
RegisterObject(GravityBombMunition);
this->maxMunitionPerMagazine_ = 1;
this->maxMagazines_ = 30;
- this->magazines_ = 10;
+ this->magazines_ = 15;
this->bUseSeparateMagazines_ = false;
this->bStackMunition_ = true;
Modified: code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.h
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.h 2015-05-22 09:06:11 UTC (rev 10454)
+++ code/branches/weaponFS15/src/modules/weapons/munitions/GravityBombMunition.h 2015-05-23 17:33:37 UTC (rev 10455)
@@ -13,7 +13,15 @@
namespace orxonox
{
-
+ /**
+ * @class GravityBombMunition
+ *
+ * @brief This class is used to set the behaviour of various
+ * munition specific attributes of the GravityBomb like max count of munition per magazine.
+ *
+ * @author Manuel
+ * @date 23.05.2015
+ */
class _WeaponsExport GravityBombMunition : public Munition
{
public:
Modified: code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc 2015-05-22 09:06:11 UTC (rev 10454)
+++ code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc 2015-05-23 17:33:37 UTC (rev 10455)
@@ -2,7 +2,7 @@
* GravityBomb.cc
*
* Created on: Mar 26, 2015
- * Author: meggiman
+ * Author: Manuel Eggimann
*/
#include "GravityBomb.h"
#include "graphics/Model.h"
@@ -11,7 +11,7 @@
namespace orxonox{
RegisterClass(GravityBomb);
- const float GravityBomb::LIFETIME = 5;
+ const float GravityBomb::LIFETIME = 5; ///< The gravity bomb lifetime in seconds.
GravityBomb::GravityBomb(Context* context):
BasicProjectile(),
@@ -40,12 +40,25 @@
rocketModel->setMeshSource("GravityBombRocket.mesh"); //Demo Model from SimpleRocket
rocketModel->scale(3.0f);
this->attach(rocketModel);
-
+ //Add second model because the bomb consists of the bomb and attached rockets (2 separate models)
Model* bombModel = new Model(this->getContext());
bombModel->setMeshSource("GravityBomb.mesh"); //Demo Model from SimpleRocket
bombModel->scale(3.0f);
this->attach(bombModel);
+ //Add particle effect to the flying rockets.
+ ParticleEmitter* fire = new ParticleEmitter(this->getContext());
+ fire->setOrientation(this->getOrientation());
+ fire->setSource("Orxonox/simplerocketfire");
+ this->attach(fire);
+
+ //Add sound effect while the bomb is flying.
+ WorldSound* bombSound = new WorldSound(context);
+ bombSound->setSource("sounds/GravityBombFlight.ogg");
+ bombSound->setLooping(true);
+ bombSound->setVolume(1.0);
+ this->attach(bombSound);
+ bombSound->play();
}
}
@@ -56,15 +69,14 @@
timeToLife_ -= dt;
if(timeToLife_ < 0)
{
- orxout(debug_output) << "bomb has stoped moving" <<endl;
- setVelocity(Vector3::ZERO);
- setAcceleration(Vector3::ZERO);
+ //orxout(debug_output) << "bomb has stoped moving" <<endl;
+ setVelocity(Vector3::ZERO); //Stop the bomb.
isDetonated_ = true;
}
else
{
- orxout(debug_output)<< "Time to live:" << timeToLife_ <<endl;
- destroyCheck();
+ //orxout(debug_output)<< "Time to live:" << timeToLife_ <<endl;
+ destroyCheck(); //Every BasicProjectil has to call this method in each tick.
}
if(isDetonated_) detonate();
else SUPER(GravityBomb, tick, dt);
@@ -72,7 +84,7 @@
bool GravityBomb::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
{
- if(otherObject != getShooter())
+ if(otherObject != getShooter()) //Ensure that the bomb cannot collide with its shooter.
{
orxout(debug_output) << "collides" << endl;
processCollision(otherObject, contactPoint,cs);
@@ -80,18 +92,19 @@
return true;
}
else{
- orxout(debug_output) << "collided with shooter. Has no effect..." << endl;
+ //orxout(debug_output) << "collided with shooter. Has no effect..." << endl;
return false;
}
}
void GravityBomb::detonate()
{
+ //Create the GravityBombField and destroy the Projectil.
GravityBombField* field = new GravityBombField(this->getContext());
field->setShooter(this->getShooter());
field->setPosition(getPosition());
- orxout(debug_output) << "detonating. Creating GravityBombField." <<endl;
- orxout(debug_output) << "Field is at Position: " << getPosition() << endl;
+ //orxout(debug_output) << "detonating. Creating GravityBombField." <<endl;
+ //orxout(debug_output) << "Field is at Position: " << getPosition() << endl;
this->destroy();
}
}
Modified: code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.h
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.h 2015-05-22 09:06:11 UTC (rev 10454)
+++ code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.h 2015-05-23 17:33:37 UTC (rev 10455)
@@ -1,33 +1,4 @@
/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Gabriel Nadler
- * Co-authors:
- * simonmie
- *
- */
-
-
-/*
* GravityBomb.h
*
* Created on: Mar 19, 2015
@@ -50,10 +21,20 @@
#include "objects/collisionshapes/SphereCollisionShape.h"
#include "../../../orxonox/worldentities/WorldEntity.h"
#include "GravityBombField.h"
+#include "sound\WorldSound.h"
namespace orxonox
{
-
+ /**
+ * @class GravityBomb
+ *
+ * @brief This class implements how long the bomb flies before it places the GravityField at it's last possition.
+ * The field will be created either because the timelimit of the bomb expired or it hit something. After creation of the field,
+ * the projectile (this object) is destroyed.
+ *
+ * @author Manuel Eggimann
+ * @date 23.05.2015
+ */
class _WeaponsExport GravityBomb : public BasicProjectile , public MovableEntity, public RadarViewable
{
public:
@@ -68,7 +49,7 @@
bool isDetonated_; //Used to check whether the Bomb has to be destroyed during next tick.
float timeToLife_; //Time the bomb flies before it explodes.
-
+ WorldSound* bombSound_;
};
}
#endif /* GravityBOMB_H_ */
Modified: code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.cc
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.cc 2015-05-22 09:06:11 UTC (rev 10454)
+++ code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.cc 2015-05-23 17:33:37 UTC (rev 10455)
@@ -2,7 +2,7 @@
* GravityBombField.cc
*
* Created on: Apr 2, 2015
- * Author: meggiman
+ * Author: Manuel Eggimann
*/
#include "GravityBombField.h"
@@ -11,21 +11,26 @@
namespace orxonox{
RegisterClass(GravityBombField);
- const float GravityBombField::FORCE_FIELD_LIFETIME = 20;
+ //Change these constants to alter the behaviour of the field.
+
+ const float GravityBombField::FORCE_FIELD_LIFETIME = 15;
const float GravityBombField::FORCE_SPHERE_START_RADIUS = 250;
const float GravityBombField::FORCE_SPHERE_START_STRENGTH = -500;
- const float GravityBombField::PEAK_EXPLOSION_FORCE = 1e6;
+ const float GravityBombField::PEAK_EXPLOSION_FORCE = 5e4;
const float GravityBombField::FORCE_FIELD_EXPLOSION_DAMMAGE = 100;
const float GravityBombField::EXPLOSION_DURATION = 1;
- const float GravityBombField::EXPLOSION_RADIUS = 400;
+ const float GravityBombField::EXPLOSION_RADIUS = 600;
const float GravityBombField::PEAK_ANGULAR_VELOCITY = 20;
+ const float GravityBombField::CENTRE_MODEL_END_SIZE = 1.5;
GravityBombField::GravityBombField(Context* context) : ForceField(context),RadarViewable(this, static_cast<WorldEntity*>(this))
{
RegisterObject(GravityBombField);
+ //Initialize variable with their initial values.
lifetime_=FORCE_FIELD_LIFETIME;
forceStrength_ = FORCE_SPHERE_START_STRENGTH;
forceSphereRadius_ = FORCE_SPHERE_START_RADIUS;
+ modelScaling_ = 1;
fieldExploded_ = false;
setVelocity(FORCE_SPHERE_START_STRENGTH);
@@ -33,26 +38,30 @@
setMode(modeSphere_s);
setCollisionResponse(false);
+ //Make the Field visible on Radar and minimap.
this->setRadarObjectColour(ColourValue(0.2, 0.2, 1.0,1)); // Blue
this->setRadarObjectShape(RadarViewable::Dot);
this->setRadarObjectScale(0.5f);
+
//Attach Model
Model* model = new Model(this->getContext());
model->setMeshSource("GravityBomb.mesh"); //Demo Model from SimpleRocket
- model->scale(3.0f);
+ model->scale(2.5f);
bombModel_ = new MovableEntity(context);
bombModel_->attach(model);
this->attach(bombModel_);
- Backlight* centreLight = new Backlight(context);
- centreLight->setColour(ColourValue(0.9,0.5,0.5,1));
- centreLight->setScale(1.0);
- centreLight->setTrailMaterial("Trail/backlighttrail");
- centreLight->setMaterial("Examples/Flare");
- centreLight->setLifetime(20);
- bombModel_->attach(centreLight);
+ //Add a Backlight to the centre.
+ centreLight_ = new Backlight(context);
+ centreLight_->setColour(ColourValue(0.2,0.9,0.2,1));
+ centreLight_->setScale(0.3);
+ centreLight_->setTrailMaterial("Trail/backlighttrail");
+ centreLight_->setMaterial("Examples/Flare");
+ centreLight_->setLifetime(20);
+ bombModel_->attach(centreLight_);
+ //Let the Bomb Modell in the centre rotate in a random direction.
Vector3 randomRotation;
srand(time(NULL));
randomRotation.x = rand();
@@ -63,52 +72,72 @@
//Add Collision Shape
SphereCollisionShape* collisionShape = new SphereCollisionShape(context);
- collisionShape->setRadius(3.0);
+ collisionShape->setRadius(10.0);
this->attachCollisionShape(collisionShape);
+ //Add particle effect to visualize the force field.
this->particleSphere_ = new ParticleEmitter(this->getContext());
this->attach(this->particleSphere_);
particleSphere_->setSource("Orxonox/GravityBombField");
+
+ //Add a sound effect to the field.
+ WorldSound* fieldSound = new WorldSound(context);
+ fieldSound->setSource("sounds/GravityField.ogg");
+ fieldSound->setLooping(true);
+ fieldSound->setVolume(1.0);
+ this->attach(fieldSound);
+ fieldSound->play();
}
GravityBombField::~GravityBombField(){}
+
void GravityBombField::tick(float dt)
{
SUPER(GravityBombField,tick,dt);
lifetime_-=dt;
- if(lifetime_ > EXPLOSION_DURATION)
+ if(lifetime_ > EXPLOSION_DURATION)//If field is still alive, make it smaller and stronger.
{
+ modelScaling_ += ((CENTRE_MODEL_END_SIZE-1) / FORCE_FIELD_LIFETIME)*dt;
forceStrength_ *= (1+dt/10);
forceSphereRadius_ = FORCE_SPHERE_START_RADIUS*(1-((FORCE_FIELD_LIFETIME-lifetime_)/FORCE_FIELD_LIFETIME)*((FORCE_FIELD_LIFETIME-lifetime_)/FORCE_FIELD_LIFETIME)*((FORCE_FIELD_LIFETIME-lifetime_)/FORCE_FIELD_LIFETIME));
}
else if(lifetime_ > 0)
{
- if (!fieldExploded_)
+ if (!fieldExploded_) // Start the field explosion if it has not been started yet.
{
- forceStrength_ = PEAK_EXPLOSION_FORCE;
+ forceStrength_ = pow((EXPLOSION_DURATION + lifetime_),4)/EXPLOSION_DURATION * PEAK_EXPLOSION_FORCE;
fieldExploded_ = true;
+ //Add particle effect to visualize explosion
explosionCross_ = new ParticleEmitter(this->getContext());
+ explosionCross_->setSource("Orxonox/FieldExplosion");
+ explosionCross_->setOrientation(rand(), rand(), rand(), rand());
+ explosionCross_->setScale(0.7);
this->attach(explosionCross_);
- explosionCross_->setSource("Orxonox/FieldExplosion");
+
+ //Add explosion sound effect.
+ explosionSound_ = new WorldSound(getContext());
+ explosionSound_->setSource("sounds/GravityFieldExplosion.ogg");
+ explosionSound_->setVolume(1.0);
+ explosionSound_->play();
}
+ //Check if any pawn is inside the shockwave and hit it with dammage proportional to the distance between explosion centre and pawn. Make sure, the same pawn is damaged only once.
for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
{
Vector3 distanceVector = it->getWorldPosition()-this->getWorldPosition();
- orxout(debug_output) << "Found Pawn:" << it->getWorldPosition() << endl;
+ //orxout(debug_output) << "Found Pawn:" << it->getWorldPosition() << endl;
if(distanceVector.length()< forceSphereRadius_)
{
- orxout(debug_output) << "Force sphere radius is: " << forceSphereRadius_ << " Distance to Pawn is: " << distanceVector.length();
+ //orxout(debug_output) << "Force sphere radius is: " << forceSphereRadius_ << " Distance to Pawn is: " << distanceVector.length();
if (std::find(victimsAlreadyDamaged_.begin(),victimsAlreadyDamaged_.end(),*it) == victimsAlreadyDamaged_.end())
{
- orxout(debug_output) << "Found Pawn to damage: " << it->getWorldPosition() << endl;
+ //orxout(debug_output) << "Found Pawn to damage: " << it->getWorldPosition() << endl;
float damage = FORCE_FIELD_EXPLOSION_DAMMAGE*(1-distanceVector.length()/EXPLOSION_RADIUS);
- orxout(debug_output) << "Damage: " << damage << endl;
+ //orxout(debug_output) << "Damage: " << damage << endl;
it->hit(shooter_, it->getWorldPosition(), NULL, damage, 0,0);
-// it->removeHealth(damage);
victimsAlreadyDamaged_.push_back(*it);
}
}
@@ -117,8 +146,9 @@
forceSphereRadius_ = EXPLOSION_RADIUS*(1-lifetime_/EXPLOSION_DURATION);
explosionCross_->setScale(forceSphereRadius_/FORCE_SPHERE_START_RADIUS);
}
- else if (lifetime_ > -4)
+ else if (lifetime_ > -6) //The field has to exist for 6 more seconds for the particles of the particle effect to vanish smoothly.
{
+ //Make the bomb model invisible, let the strength of the field be zero and remove all particle emitters so the particle effect will slowly vanish.
bombModel_->setVisible(false);
this->setRadarVisibility(false);
forceStrength_ = 0;
@@ -126,10 +156,11 @@
particleSphere_->getParticleInterface()->removeAllEmitters();
explosionCross_->getParticleInterface()->removeAllEmitters();
}
-
+
setDiameter(forceSphereRadius_*2);
setVelocity(forceStrength_);
- particleSphere_->setScale(forceSphereRadius_/FORCE_SPHERE_START_RADIUS);
+ if(lifetime_>0) particleSphere_->setScale(forceSphereRadius_/FORCE_SPHERE_START_RADIUS);
+ bombModel_->setScale(modelScaling_);
if (lifetime_ <= -4)
{
@@ -140,7 +171,6 @@
void GravityBombField::destroy()
{
- //Animation
ForceField::destroy();
}
Modified: code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.h
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.h 2015-05-22 09:06:11 UTC (rev 10454)
+++ code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.h 2015-05-23 17:33:37 UTC (rev 10455)
@@ -19,9 +19,21 @@
#include "tools/ParticleInterface.h"
#include <stdlib.h>
#include <time.h>
+#include <math.h>
#include "graphics/Backlight.h"
+#include "sound\WorldSound.h"
namespace orxonox {
+
+/**
+ * @class GravityBombField
+ *
+ * @brief This class is used by GravityBomb to place the ForceField and Visual effect to the environment.
+ * The field has a maximum lifetime and gets smaller and stronger the more time passes. In the end, the field explodes and damages all pawns nearby.
+ *
+ * @author Manuel Eggimann
+ * @date 23.05.2015
+ */
class GravityBombField: public ForceField, public RadarViewable {
public:
GravityBombField(Context* context);
@@ -29,6 +41,16 @@
virtual void tick(float dt);
virtual void destroy();
+ /**
+ * @fn void GravityBombField::setShooter(Pawn* shooter)
+ *
+ * @brief This function is used to determine save the pawn who created the field and is used inside the GravityBomb class.
+ *
+ * @author Manuel Eggimann
+ * @date 23.05.2015
+ *
+ * @param [in,out] the Pawn that created the field.
+ */
void setShooter(Pawn* shooter)
{ this->shooter_ = shooter; }
@@ -36,18 +58,22 @@
{ return this->shooter_; }
private:
- static const float FORCE_FIELD_LIFETIME;
- static const float FORCE_SPHERE_START_RADIUS;
- static const float FORCE_SPHERE_START_STRENGTH;
- static const float FORCE_FIELD_EXPLOSION_DAMMAGE;
- static const float EXPLOSION_DURATION;
- static const float EXPLOSION_RADIUS;
- static const float PEAK_ANGULAR_VELOCITY;
- static const float PEAK_EXPLOSION_FORCE;
+ //Set these constants inside GravityBombField.cc to alter the behaviour of the field.
+
+ static const float FORCE_FIELD_LIFETIME; ///< The lifetime of the ForceField in seconds. After lifetime seconds, has already exploded and the particle effects will start to vanish.
+ static const float FORCE_SPHERE_START_RADIUS; ///< The initial sphere radius of the Force Field. The forcefield gets smaller by time.
+ static const float FORCE_SPHERE_START_STRENGTH; ///< The initial Force the Field exerts on every object with non-zero mass.
+ static const float FORCE_FIELD_EXPLOSION_DAMMAGE; ///< The maximum dammage a pawn gets nearby an exploding field. The farer away from explosion center the smaller the dammage.
+ static const float EXPLOSION_DURATION; ///< Determines how fast the shockwave of the Explosion expands. It takes GravityBombField::EXPLOSION_DURATION seconds for the field to expand from 0 radius to GravityBombField::EXPLOSION_RADIUS.
+ static const float EXPLOSION_RADIUS; ///< How far does the shockwave reach. All pawns which outside of a sphere witch this radius rest unharmed by the explosion.
+ static const float PEAK_ANGULAR_VELOCITY; ///< The model of the bomb in the center of the Field does rotate faster and faster as time passes until it reaches PEAK_ANGULAR_VELOCITY at the fields end of life.
+ static const float PEAK_EXPLOSION_FORCE; ///< The peak force the explosion exerts on the pawns nearby.
+ static const float CENTRE_MODEL_END_SIZE; ///< Size of the 3d-model of the bomb in the fields centre.
float forceSphereRadius_;
float forceStrength_;
float lifetime_;
+ float modelScaling_;
Vector3 rotationVector_;
bool fieldExploded_;
ParticleEmitter * particleSphere_;
@@ -55,6 +81,8 @@
std::vector<Pawn*> victimsAlreadyDamaged_;
MovableEntity * bombModel_;
Pawn* shooter_;
+ Backlight* centreLight_;
+ WorldSound* explosionSound_;
};
}
Modified: code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.cc
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.cc 2015-05-22 09:06:11 UTC (rev 10454)
+++ code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.cc 2015-05-23 17:33:37 UTC (rev 10455)
@@ -2,7 +2,7 @@
* GravityBombFire.cc
*
* Created on: Apr 16, 2015
- * Author: meggiman
+ * Author: Manuel Eggimann
*/
#include "GravityBombFire.h"
@@ -18,19 +18,18 @@
{
RegisterClass(GravityBombFire);
- const float GravityBombFire::BOMB_VELOCITY = 400.0;
+ const float GravityBombFire::BOMB_VELOCITY = 400.0; ///< The velocity of the bomb after launch
GravityBombFire::GravityBombFire(Context* context) : WeaponMode(context)
{
RegisterObject(GravityBombFire);
- this->reloadTime_ = 0.50f;
+ this->reloadTime_ = 0.50f;
this->bParallelReload_ = false;
- this->damage_ = 0.0f;
- this->speed_ = BOMB_VELOCITY;
+ this->damage_ = 20.0f; ///< The damage of the Bomb if it hits a pawn.
this->setMunitionName("GravityBombMunition");
- this->setDefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.8);
+ this->setDefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.8); ///< sets sound of the bomb as it is fired.
}
GravityBombFire::~GravityBombFire(){};
@@ -38,11 +37,13 @@
void GravityBombFire::fire()
{
GravityBomb* bomb = new GravityBomb(this->getContext());
- this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
+ //Create a new Bomb in 3D-Space and set the right direction speed and orientation.
+ this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
bomb->setOrientation(this->getMuzzleOrientation());
bomb->setPosition(this->getMuzzlePosition());
- bomb->setVelocity(this->getMuzzleDirection() * (this->speed_+this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity().length()));
+ bomb->setVelocity(this->getMuzzleDirection() * (this->BOMB_VELOCITY+this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity().length()));
+ //Set the shooter of the bomb so it is possible to determine the pawn that killed another one and define damage to shield and healt the bomb does.
bomb->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
bomb->setDamage(this->getDamage());
bomb->setShieldDamage(this->getShieldDamage());
Modified: code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.h
===================================================================
--- code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.h 2015-05-22 09:06:11 UTC (rev 10454)
+++ code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.h 2015-05-23 17:33:37 UTC (rev 10455)
@@ -1,30 +1,9 @@
-/**
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Oliver Scheuss
- * Co-authors:
- * ...
- *
- */
+/*
+* GravityBombFire.h
+*
+* Created on: Apr 16, 2015
+* Author: Manuel Eggimann
+*/
/**
@file GravityBombFire.h
@@ -41,11 +20,12 @@
{
/**
- @brief
- Fires the GravityBomb
- @author
- Manuel Eggimann
- @ingroup WeaponsWeaponModes
+ *@brief
+ * Fires the GravityBomb. This class implements everything needed to fire the BasicProjectile GravityBomb.
+ * Everything that has to do with the bombs behaviour after launching it is implemented in GravityBomb and GravityBombField.
+ *@author
+ * Manuel Eggimann
+ *@ingroup WeaponsWeaponModes
*/
class _WeaponsExport GravityBombFire : public WeaponMode
{
@@ -56,8 +36,7 @@
virtual void fire();
private:
- float speed_; //!< The initial speed of the bomb when it is launched.
- static const float BOMB_VELOCITY;
+ static const float BOMB_VELOCITY; //!< The initial speed of the bomb when it is launched.
};
}
More information about the Orxonox-commit
mailing list