Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Implemented all necessary classes. No the weapon works without bugs.

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        GravityBombFire::GravityBombFire(Context* context) : WeaponMode(context)
22        {
23                RegisterObject(GravityBombFire);
24
25                this->reloadTime_ = 0.50f;
26                this->bParallelReload_ = false;
27                this->damage_ = 0.0f;
28                this->speed_ = 100.0f;
29
30                this->setMunitionName("GravityBombMunition");
31                // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning)
32        }
33
34        GravityBombFire::~GravityBombFire(){};
35
36        void GravityBombFire::fire()
37        {
38                GravityBomb* bomb = new GravityBomb(this->getContext());
39        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
40        bomb->setOrientation(this->getMuzzleOrientation());
41        bomb->setPosition(this->getMuzzlePosition());
42        bomb->setVelocity(this->getMuzzleDirection() * (this->speed_+this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getVelocity().length()));
43
44        bomb->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
45                bomb->setDamage(this->getDamage());
46                bomb->setShieldDamage(this->getShieldDamage());
47                bomb->setHealthDamage(this->getHealthDamage());
48        }
49
50
51}
52
53
Note: See TracBrowser for help on using the repository browser.