Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/orxonox_tutorial/src/orxonox/objects/TutorialShip.cc @ 1855

Last change on this file since 1855 was 1855, checked in by rgrieder, 16 years ago

TutorialShip should now do basic stuff.

  • 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 *      Oliver 'greenman' Scheuss, Reto '1337' Grieder
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29// for precompiled header files. Has to be first!
30#include "OrxonoxStableHeaders.h"
31// always include this class's header file first so that it compiles on its own too.
32#include "TutorialShip.h"
33
34// Additional includes
35#include <OgreSceneNode.h>
36#include "util/Convert.h"
37#include "util/Debug.h"
38#include "util/Math.h"
39#include "core/ConfigValueIncludes.h"
40#include "core/ConsoleCommand.h"
41#include "core/CoreIncludes.h"
42#include "core/input/InputManager.h"
43#include "core/XMLPort.h"
44
45namespace orxonox
46{
47    SetConsoleCommand(TutorialShip, fire, true).keybindMode(KeybindMode::OnHold);
48
49    CreateFactory(TutorialShip);
50
51    TutorialShip::TutorialShip()
52    {
53        RegisterObject(TutorialShip);
54
55        // reset variables
56        this->hasSpecialEffects_ = false;
57
58        // set config values
59        this->setConfigValues();
60    }
61
62    bool TutorialShip::create()
63    {
64        return true;
65    }
66
67    TutorialShip::~TutorialShip()
68    {
69    }
70   
71    void TutorialShip::setConfigValues()
72    {
73        SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds");
74    }
75
76    //void TutorialShip::registerAllVariables()
77    //{
78    //}
79   
80    /**
81        @brief XML loading and saving.
82        @param xmlelement The XML-element
83        @param loading Loading (true) or saving (false)
84        @return The XML-element
85    */
86    void TutorialShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
87    {
88        XMLPortParam(TutorialShip, "specialEffects", setSpecialEffects, hasSpecialEffects, xmlelement, mode);
89
90        // Calls SpaceShip::XMLPort
91        SUPER(TutorialShip, XMLPort, xmlelement, mode);
92    }
93
94    bool TutorialShip::hasSpecialEffects()
95    {
96        return this->hasSpecialEffects_;
97    }
98
99    void TutorialShip::setSpecialEffects(bool value)
100    {
101        this->hasSpecialEffects_ = value;
102    }
103
104    /**
105        @brief Returns the weapon reload time. Used virtually by the base class.
106    */
107    float TutorialShip::getReloadTime()
108    {
109        return this->reloadTime_;
110    }
111
112   
113    void TutorialShip::tick(float dt)
114    {
115        SUPER(TutorialShip, tick, dt);
116    }
117
118    void TutorialShip::fire()
119    {
120        SpaceShip::getLocalShip()->doFire();
121    }
122}
Note: See TracBrowser for help on using the repository browser.