Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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