Changeset 1857 for code/branches/orxonox_tutorial/src/orxonox
- Timestamp:
- Sep 29, 2008, 9:25:27 AM (16 years ago)
- Location:
- code/branches/orxonox_tutorial/src/orxonox/objects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/orxonox_tutorial/src/orxonox/objects/TutorialShip.cc
r1855 r1857 29 29 // for precompiled header files. Has to be first! 30 30 #include "OrxonoxStableHeaders.h" 31 // always include this class's header file first so that it compiles on its own too. 31 // always include this class's header file first so that 32 // it compiles on its own too. 32 33 #include "TutorialShip.h" 33 34 34 35 // Additional includes 35 #include <OgreSceneNode.h>36 36 #include "util/Convert.h" 37 37 #include "util/Debug.h" … … 45 45 namespace orxonox 46 46 { 47 SetConsoleCommand(TutorialShip, fire, true).keybindMode(KeybindMode::OnHold); 47 // Specify a console command that can be used in 48 // the shell or as key binding. 49 SetConsoleCommand(TutorialShip, fire, true) 50 .keybindMode(KeybindMode::OnHold); 48 51 52 // Make sure we can create an object of this class by XML 49 53 CreateFactory(TutorialShip); 50 54 55 // Constructor 51 56 TutorialShip::TutorialShip() 52 57 { … … 60 65 } 61 66 62 bool TutorialShip::create() 63 { 64 return true; 65 } 66 67 // Destructor 67 68 TutorialShip::~TutorialShip() 68 69 { 69 70 } 70 71 72 // Sets the configurable member variables. 73 // They can be found later in orxonox.ini directly. 71 74 void TutorialShip::setConfigValues() 72 75 { 73 SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds"); 76 SetConfigValue(reloadTime_, 0.125) 77 .description("The reload time of the weapon in seconds"); 74 78 } 75 76 //void TutorialShip::registerAllVariables()77 //{78 //}79 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 */ 80 // Called when loading an object of this class with XML 81 // You don't have to know what exactly xmlelement is. 82 // And mode is not important yet (load/save). 86 83 void TutorialShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) 87 84 { 88 XMLPortParam(TutorialShip, "specialEffects", setSpecialEffects, hasSpecialEffects, xmlelement, mode); 85 // Load our parameter "specialEffects". Case sensitive! 86 XMLPortParam(TutorialShip, "specialEffects", setSpecialEffects, 87 hasSpecialEffects, xmlelement, mode); 89 88 90 // Calls SpaceShip::XMLPort 89 // Calls SpaceShip::XMLPort so that the SpaceShip XML parameters 90 // are loaded too. 91 91 SUPER(TutorialShip, XMLPort, xmlelement, mode); 92 92 } 93 93 94 // XML save function. Also used by back end class SpaceShip 95 // to show or hide the special effects. 94 96 bool TutorialShip::hasSpecialEffects() 95 97 { … … 97 99 } 98 100 101 // XML load function. Called by the XML macro above. 99 102 void TutorialShip::setSpecialEffects(bool value) 100 103 { … … 102 105 } 103 106 104 /** 105 @brief Returns the weapon reload time. Used virtually by the base class. 106 */ 107 // virtual function used by back end class SpaceShip. 107 108 float TutorialShip::getReloadTime() 108 109 { … … 110 111 } 111 112 112 113 // run time update method. Gets called every frame with the delta time that 114 // has passed since the last frame. 113 115 void TutorialShip::tick(float dt) 114 116 { 117 // Also call the tick() method of the base clas. 115 118 SUPER(TutorialShip, tick, dt); 116 119 } 117 120 121 // Fire a projectile. Delegated to the back end class SpaceShip. 122 // Function content is insignificant for the tutorial. 118 123 void TutorialShip::fire() 119 124 { -
code/branches/orxonox_tutorial/src/orxonox/objects/TutorialShip.h
r1855 r1857 49 49 ~TutorialShip(); 50 50 51 bool create();52 51 //void registerAllVariables(); 53 52 void setConfigValues();
Note: See TracChangeset
for help on using the changeset viewer.