Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Alle Klassen implementiert um die Waffe abzufeuern. Noch sehr fehlerhaft.

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_ = 200.0f;
29                this->slowDownRate_ = -10.0f;
30
31                this->setMunitionName("GravityBombMunition");
32                // The firing sound of the Rocket is played in Rocket.cc (because of OpenAl sound positioning)
33        }
34
35        GravityBombFire::~GravityBombFire(){};
36
37        void GravityBombFire::fire()
38        {
39                GravityBomb* bomb = new GravityBomb(this->getContext());
40        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
41        bomb->setOrientation(this->getMuzzleOrientation());
42        bomb->setPosition(this->getMuzzlePosition());
43        bomb->setVelocity(this->getMuzzleDirection() * this->speed_);
44        bomb->setAcceleration(this->getMuzzleDirection()* this->slowDownRate_);
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.