Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/weapons/weaponmodes/GravityBombFire.cc @ 11972

Last change on this file since 11972 was 11108, checked in by fvultier, 9 years ago

A few modifications in the weapon system: WeaponModes may play a reload sound now. Fireing Sounds of WeaponModes may overlap now. New weapon: FlameGun, a flame thrower for close combat (e.g. for the FPS player)

  • Property svn:eol-style set to native
File size: 2.0 KB
RevLine 
[10369]1/*
2 * GravityBombFire.cc
3 *
4 *  Created on: Apr 16, 2015
[10455]5 *      Author: Manuel Eggimann
[10369]6 */
7#include "GravityBombFire.h"
8
9#include "core/CoreIncludes.h"
10#include "weaponsystem/Weapon.h"
11#include "weaponsystem/WeaponPack.h"
12#include "weaponsystem/WeaponSystem.h"
13#include "worldentities/pawns/Pawn.h"
14
15#include "weapons/projectiles/GravityBomb.h"
16
17namespace orxonox
18{
[10601]19    RegisterClass(GravityBombFire);
[10369]20
[10601]21    const float GravityBombFire::BOMB_VELOCITY = 600.0; ///< The velocity of the bomb after launch
[10435]22
[10601]23    GravityBombFire::GravityBombFire(Context* context) : WeaponMode(context)
24    {
25        RegisterObject(GravityBombFire);
[10369]26
[10601]27        this->reloadTime_ = 0.50f; 
28        this->bParallelReload_ = false;
29        this->damage_ = 20.0f;  ///< The damage of the Bomb if it hits a pawn.
[10369]30
[10601]31        this->setMunitionName("GravityBombMunition");
[11108]32        this->setFireSound("sounds/Rocket_launch.ogg",0.8);    ///< sets sound of the bomb as it is fired.
[11052]33
34        hudImageString_ = "Orxonox/WSHUD_WM_GravityBombFire";
[10601]35    }
[10369]36
[10601]37    GravityBombFire::~GravityBombFire(){};
[10369]38
[10601]39    void GravityBombFire::fire()
40    {
41        GravityBomb* bomb = new GravityBomb(this->getContext());
[10455]42        //Create a new Bomb in 3D-Space and set the right direction speed and orientation.
[10601]43        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
[10369]44        bomb->setOrientation(this->getMuzzleOrientation());
45        bomb->setPosition(this->getMuzzlePosition());
[10455]46        bomb->setVelocity(this->getMuzzleDirection() * (this->BOMB_VELOCITY+this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity().length()));
[10369]47
[10601]48        //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.
[10369]49        bomb->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
[10601]50        bomb->setDamage(this->getDamage());
51        bomb->setShieldDamage(this->getShieldDamage());
52        bomb->setHealthDamage(this->getHealthDamage());
53    }
[10369]54
55
56}
57
58
Note: See TracBrowser for help on using the repository browser.