Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pch/src/orxonox/objects/weaponsystem/projectiles/LightningGunProjectile.cc @ 3178

Last change on this file since 3178 was 3110, checked in by rgrieder, 15 years ago

Removed old msvc specific support for precompiled header files.

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Joel Smely
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "LightningGunProjectile.h"
30
31#include <OgreBillboardSet.h>
32
33#include "core/GameMode.h"
34#include "core/CoreIncludes.h"
35#include "objects/Scene.h"
36#include "util/Convert.h"
37
38namespace orxonox
39{
40    CreateFactory(LightningGunProjectile);
41
42    LightningGunProjectile::LightningGunProjectile(BaseObject* creator) : BillboardProjectile(creator)
43    {
44        RegisterObject(LightningGunProjectile);
45
46        this->textureIndex_ = 1;
47        this->maxTextureIndex_ = 8;
48        this->textureTimer_.setTimer(0.01, true, this, createExecutor(createFunctor(&LightningGunProjectile::changeTexture)));
49       
50        registerVariables();
51    }
52   
53    void LightningGunProjectile::registerVariables()
54    {
55        registerVariable(this->materialBase_);
56    }
57   
58    void LightningGunProjectile::setMaterial(const std::string& material)
59    {
60        this->materialBase_ = material;   
61   
62        BillboardProjectile::setMaterial(material + convertToString(this->textureIndex_));
63    }
64
65    void LightningGunProjectile::changeTexture()
66    {
67        this->textureIndex_++;
68        if (this->textureIndex_ > this->maxTextureIndex_)
69            this->textureIndex_ = 1;
70       
71        this->setMaterial(this->materialBase_);
72    }
73}
Note: See TracBrowser for help on using the repository browser.