Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.cc @ 10438

Last change on this file since 10438 was 10438, checked in by meggiman, 9 years ago

Added sound-effects to bomb.

File size: 1.5 KB
Line 
1/*
2 * GravityBombFire.cc
3 *
4 *  Created on: Apr 16, 2015
5 *      Author: meggiman
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{
19        RegisterClass(GravityBombFire);
20
21        const float GravityBombFire::BOMB_VELOCITY = 400.0;
22
23        GravityBombFire::GravityBombFire(Context* context) : WeaponMode(context)
24        {
25                RegisterObject(GravityBombFire);
26
27                this->reloadTime_ = 0.50f;
28                this->bParallelReload_ = false;
29                this->damage_ = 0.0f;
30                this->speed_ = BOMB_VELOCITY;
31
32                this->setMunitionName("GravityBombMunition");
33                this->setDefaultSoundWithVolume("sounds/Rocket_launch.ogg",0.8);
34        }
35
36        GravityBombFire::~GravityBombFire(){};
37
38        void GravityBombFire::fire()
39        {
40                GravityBomb* bomb = new GravityBomb(this->getContext());
41        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
42        bomb->setOrientation(this->getMuzzleOrientation());
43        bomb->setPosition(this->getMuzzlePosition());
44        bomb->setVelocity(this->getMuzzleDirection() * (this->speed_+this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity().length()));
45
46        bomb->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
47                bomb->setDamage(this->getDamage());
48                bomb->setShieldDamage(this->getShieldDamage());
49                bomb->setHealthDamage(this->getHealthDamage());
50        }
51
52
53}
54
55
Note: See TracBrowser for help on using the repository browser.