Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/orxonox/objects/Projectile.cc @ 643

Last change on this file since 643 was 643, checked in by landauf, 16 years ago

added a simple firing mode to SpaceShip

File size: 1.0 KB
Line 
1#include "Projectile.h"
2#include "../core/CoreIncludes.h"
3
4namespace orxonox
5{
6    CreateFactory(Projectile);
7
8    Projectile::Projectile(SpaceShip* owner)
9    {
10        RegisterObject(Projectile);
11
12        this->owner_ = owner;
13
14        SetConfigValue(lifetime_, 10.0);
15        SetConfigValue(speed_, 2000.0);
16
17        this->billboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.5), 1);
18        this->attachObject(this->billboard_.getBillboardSet());
19        this->scale(0.5);
20
21        if (this->owner_)
22        {
23            this->setStatic(false);
24            this->setOrientation(this->owner_->getOrientation());
25            this->setPosition(this->owner_->getPosition());
26            this->setVelocity(Vector3(1, 0, 0) * this->speed_);
27        }
28
29        this->destroyTimer_.setTimer(this->lifetime_, false, this, &Projectile::destroyObject);
30    }
31
32    Projectile::~Projectile()
33    {
34    }
35
36    void Projectile::destroyObject()
37    {
38        delete this;
39    }
40}
Note: See TracBrowser for help on using the repository browser.