Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc @ 10656

Last change on this file since 10656 was 10629, checked in by fvultier, 9 years ago

Merged towerdefenseFabien branch back to trunk. The towerdefense Minigame is now a plugin.

  • Property svn:eol-style set to native
File size: 3.1 KB
RevLine 
[2099]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 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
[8855]29/**
30    @file BillboardProjectile.h
31    @brief Implementation of the BillboardProjectile class.
32*/
33
[2099]34#include "BillboardProjectile.h"
35
[3196]36#include "core/CoreIncludes.h"
[2896]37#include "core/GameMode.h"
[5735]38#include "Scene.h"
[2099]39
40namespace orxonox
41{
[9667]42    RegisterClass(BillboardProjectile);
[2099]43
[9667]44    BillboardProjectile::BillboardProjectile(Context* context) : Projectile(context)
[2099]45    {
46        RegisterObject(BillboardProjectile);
47
[2896]48        if (GameMode::showsGraphics())
[2662]49        {
50            assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity
[8855]51
52            // Create the billboard.
[3196]53            this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5f, 0.5f, 0.7f, 0.8f), 1);
[2662]54            this->attachOgreObject(this->billboard_.getBillboardSet());
55        }
56
[6502]57        this->setScale(0.2f);
[2099]58    }
59
60    BillboardProjectile::~BillboardProjectile()
61    {
[2896]62        if (this->isInitialized() && GameMode::showsGraphics() && this->billboard_.getBillboardSet())
[2662]63            this->detachOgreObject(this->billboard_.getBillboardSet());
[2099]64    }
65
[8855]66    /**
67    @brief
68        Set the colour of the BillboardProjectile.
69    @param colour
70        The colour to be set.
71    */
[2099]72    void BillboardProjectile::setColour(const ColourValue& colour)
73    {
[2662]74        this->billboard_.setColour(colour);
[2099]75    }
[5735]76
[8855]77    /**
78    @brief
79        Set the material of the BillboardProjectile.
80    @param material
81        The material name.
82    */
[2969]83    void BillboardProjectile::setMaterial(const std::string& material)
84    {
85        this->billboard_.setMaterial(material);
86    }
[2099]87
[8855]88    /**
89    @brief
[10629]90        Get the material of the BillboardProjectile.
91    @return
92        The material name.
93    */
94    const std::string& BillboardProjectile::getMaterial()
95    {
96        return this->billboard_.getMaterial();
97    }
98
99    /**
100    @brief
[8855]101        Is called when the visibility of the BillboardProjectile has changed.
102    */
[2099]103    void BillboardProjectile::changedVisibility()
104    {
105        SUPER(BillboardProjectile, changedVisibility);
[2662]106
[8855]107        // Also change the visibility of the billboard.
[2099]108        this->billboard_.setVisible(this->isVisible());
109    }
110}
Note: See TracBrowser for help on using the repository browser.