Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/tutorialHS08/src/orxonox/objects/TutorialShip.cc @ 12412

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

final adjustments to the tutorial

  • Property svn:eol-style set to native
File size: 3.5 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *                         TUTORIAL
6 */
7
8// for precompiled header files. Has to be first!
9#include "OrxonoxStableHeaders.h"
10// always include this class's header file first so that
11// it compiles on its own too.
12#include "TutorialShip.h"
13
14// Additional includes
15#include <OgreEntity.h>
16#include <OgreSceneNode.h>
17#include <OgreSceneManager.h>
18#include <OgreLight.h>
19#include "util/Convert.h"
20#include "util/Debug.h"
21#include "core/ConfigValueIncludes.h"
22#include "core/ConsoleCommand.h"
23#include "core/CoreIncludes.h"
24#include "core/input/InputManager.h"
25#include "core/XMLPort.h"
26#include "GraphicsEngine.h"
27
28namespace orxonox
29{
30    // Specify a console command that can be used in
31    // the shell or as key binding.
32    /* INSERT CODE */
33
34    // Make sure we can create an object of this class by XML
35    CreateFactory(TutorialShip);
36
37    // Constructor
38    TutorialShip::TutorialShip()
39    {
40        /* INSERT CODE */
41
42        // reset variables
43        this->hasSpecialEffects_ = false;
44
45        // set config values
46        this->setConfigValues();
47    }
48
49    // Destructor
50    TutorialShip::~TutorialShip()
51    {
52    }
53
54    // Sets the configurable member variables.
55    // They can be found later in orxonox.ini directly.
56    void TutorialShip::setConfigValues()
57    {
58        /* INSERT CODE */
59    }
60   
61    // Called when loading an object of this class with XML
62    // You don't have to know what exactly xmlelement is.
63    // And mode is not important yet (load/save).
64    void TutorialShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
65    {
66        // Load our parameter "specialEffects". Case sensitive!
67        /* INSERT CODE */
68
69        // Calls SpaceShip::XMLPort so that the SpaceShip XML parameters
70        // are loaded too.
71        SUPER(TutorialShip, XMLPort, xmlelement, mode);
72
73        // Display a message in shell/logfile/console
74        /* INSERT CODE */
75
76        // Additional tutorial expedition
77        //Ogre::SceneNode* shipNode = this->getNode();
78        //Ogre::SceneManager* mgr = GraphicsEngine::getInstance().getLevelSceneManager();
79        //Ogre::SceneNode* newNode = shipNode->createChildSceneNode("newNode");
80        //Ogre::BillboardSet* bbset = mgr->createBillboardSet("TutBBS");
81        //bbset->createBillboard(Vector3(0,0,0), ColourValue(1,1,1));
82        //bbset->setMaterialName("Examples/Flare");
83        //newNode->setPosition(Vector3(30,0,0));
84        //newNode->scale(Vector3(0.1));
85        //newNode->attachObject(bbset);
86    }
87
88    // XML save function. Also used by back end class SpaceShip
89    // to show or hide the special effects.
90    bool TutorialShip::hasSpecialEffects()
91    {
92        return this->hasSpecialEffects_;
93    }
94
95    // XML load function. Called by the XML macro above.
96    void TutorialShip::setSpecialEffects(bool value)
97    {
98        this->hasSpecialEffects_ = value;
99    }
100
101    /*** NOT SO IMPORTATANT... ***/
102
103    // run time update method. Gets called every frame with the delta time that
104    // has passed since the last frame.
105    void TutorialShip::tick(float dt)
106    {
107        // Also call the tick() method of the base clas.
108        SUPER(TutorialShip, tick, dt);
109    }
110
111    // virtual function used by back end class SpaceShip.
112    float TutorialShip::getReloadTime()
113    {
114        return this->reloadTime_;
115    }
116
117    // Fire a projectile. Delegated to the back end class SpaceShip.
118    // Function content is insignificant for the tutorial.
119    void TutorialShip::fire()
120    {
121        SpaceShip::getLocalShip()->doFire();
122    }
123}
Note: See TracBrowser for help on using the repository browser.