Changeset 1859 for code/branches/orxonox_tutorial/src/orxonox/objects
- Timestamp:
- Sep 30, 2008, 4:25:16 PM (16 years ago)
- Location:
- code/branches/orxonox_tutorial/src/orxonox/objects
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/orxonox_tutorial/src/orxonox/objects/SpaceShip.cc
r1855 r1859 205 205 void SpaceShip::init() 206 206 { 207 if ( Settings::showsGraphics())207 if (this->hasSpecialEffects()) 208 208 { 209 209 // START CREATING THRUSTERS … … 258 258 259 259 // START CREATING ADDITIONAL EFFECTS 260 if (this->hasSpecialEffects()) 261 { 262 this->backlight_ = new Backlight(this->maxSpeed_, 0.8); 263 this->attachObject(this->backlight_); 264 this->backlight_->setPosition(-2.35, 0, 0.2); 265 this->backlight_->setColour(this->getProjectileColour()); 266 267 this->smoke_ = new ParticleSpawner(); 268 this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3); 269 this->attachObject(this->smoke_); 270 271 this->fire_ = new ParticleSpawner(); 272 this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1); 273 this->attachObject(this->fire_); 274 } 260 this->backlight_ = new Backlight(this->maxSpeed_, 0.8); 261 this->attachObject(this->backlight_); 262 this->backlight_->setPosition(-2.35, 0, 0.2); 263 this->backlight_->setColour(this->getProjectileColour()); 264 265 this->smoke_ = new ParticleSpawner(); 266 this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3); 267 this->attachObject(this->smoke_); 268 269 this->fire_ = new ParticleSpawner(); 270 this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1); 271 this->attachObject(this->fire_); 275 272 // END CREATING ADDITIONAL EFFECTS 276 277 if (!this->isExactlyA(Class(SpaceShipAI))) 278 { 279 // START of testing crosshair 280 this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1); 281 this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1); 282 283 this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0)); 284 this->chNearNode_->setInheritScale(false); 285 this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0)); 286 this->chFarNode_->setInheritScale(false); 287 288 this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet()); 289 this->chNearNode_->setScale(0.2, 0.2, 0.2); 290 291 this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet()); 292 this->chFarNode_->setScale(0.4, 0.4, 0.4); 293 // END of testing crosshair 294 } 295 } 296 // END of testing crosshair 273 } 274 275 if (!this->isExactlyA(Class(SpaceShipAI))) 276 { 277 // START of testing crosshair 278 this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1); 279 this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1); 280 281 this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0)); 282 this->chNearNode_->setInheritScale(false); 283 this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0)); 284 this->chFarNode_->setInheritScale(false); 285 286 this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet()); 287 this->chNearNode_->setScale(0.2, 0.2, 0.2); 288 289 this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet()); 290 this->chFarNode_->setScale(0.4, 0.4, 0.4); 291 // END of testing crosshair 292 } 297 293 298 294 createCamera(); … … 311 307 SUPER(SpaceShip, changedVisibility); 312 308 313 this->tt1_->setEnabled(this->isVisible()); 314 this->tt2_->setEnabled(this->isVisible()); 315 this->redBillboard_.setVisible(this->isVisible()); 316 this->greenBillboard_.setVisible(this->isVisible()); 309 if (this->hasSpecialEffects()) 310 { 311 this->tt1_->setEnabled(this->isVisible()); 312 this->tt2_->setEnabled(this->isVisible()); 313 this->redBillboard_.setVisible(this->isVisible()); 314 this->greenBillboard_.setVisible(this->isVisible()); 315 this->rightThrusterFlare_.setVisible(this->isVisible()); 316 this->leftThrusterFlare_.setVisible(this->isVisible()); 317 this->smoke_->setVisible(this->isVisible()); 318 this->fire_->setVisible(this->isVisible()); 319 this->backlight_->setVisible(this->isVisible()); 320 } 317 321 this->crosshairNear_.setVisible(this->isVisible()); 318 322 this->crosshairFar_.setVisible(this->isVisible()); 319 this->rightThrusterFlare_.setVisible(this->isVisible());320 this->leftThrusterFlare_.setVisible(this->isVisible());321 this->smoke_->setVisible(this->isVisible());322 this->fire_->setVisible(this->isVisible());323 this->backlight_->setVisible(this->isVisible());324 323 } 325 324 … … 328 327 SUPER(SpaceShip, changedActivity); 329 328 330 this->tt1_->setEnabled(this->isVisible()); 331 this->tt2_->setEnabled(this->isVisible()); 332 this->redBillboard_.setVisible(this->isVisible()); 333 this->greenBillboard_.setVisible(this->isVisible()); 329 if (this->hasSpecialEffects()) 330 { 331 this->tt1_->setEnabled(this->isVisible()); 332 this->tt2_->setEnabled(this->isVisible()); 333 this->redBillboard_.setVisible(this->isVisible()); 334 this->greenBillboard_.setVisible(this->isVisible()); 335 this->rightThrusterFlare_.setVisible(this->isVisible()); 336 this->leftThrusterFlare_.setVisible(this->isVisible()); 337 } 334 338 this->crosshairNear_.setVisible(this->isVisible()); 335 339 this->crosshairFar_.setVisible(this->isVisible()); 336 this->rightThrusterFlare_.setVisible(this->isVisible());337 this->leftThrusterFlare_.setVisible(this->isVisible());338 340 } 339 341 … … 445 447 this->cam_->tick(dt); 446 448 447 if ( Settings::showsGraphics())449 if (this->hasSpecialEffects()) 448 450 { 449 451 if (this->smoke_) … … 565 567 this->yaw(Radian(this->mouseYRotation_ * dt)); 566 568 567 if (this->acceleration_.x > 0) 568 { 569 this->tt1_->setEnabled(true); 570 this->tt2_->setEnabled(true); 571 } 572 else 573 { 574 this->tt1_->setEnabled(false); 575 this->tt2_->setEnabled(false); 569 if (this->hasSpecialEffects()) 570 { 571 if (this->acceleration_.x > 0) 572 { 573 this->tt1_->setEnabled(true); 574 this->tt2_->setEnabled(true); 575 } 576 else 577 { 578 this->tt1_->setEnabled(false); 579 this->tt2_->setEnabled(false); 580 } 576 581 } 577 582 -
code/branches/orxonox_tutorial/src/orxonox/objects/SpaceShip.h
r1855 r1859 100 100 101 101 virtual float getReloadTime() { return this->reloadTime_; } 102 virtual bool hasSpecialEffects() { return false; }102 virtual bool hasSpecialEffects() { return true; } 103 103 104 104 inline const Vector3& getDir() const -
code/branches/orxonox_tutorial/src/orxonox/objects/TutorialShip.cc
r1857 r1859 3 3 * > www.orxonox.net < 4 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 * 5 * TUTORIAL 27 6 */ 28 7 … … 36 15 #include "util/Convert.h" 37 16 #include "util/Debug.h" 38 #include "util/Math.h"39 17 #include "core/ConfigValueIncludes.h" 40 18 #include "core/ConsoleCommand.h" … … 90 68 // are loaded too. 91 69 SUPER(TutorialShip, XMLPort, xmlelement, mode); 70 71 // Display a message in shell/logfile/console 72 COUT(3) << "TutorialShip was loaded." << std::endl; 92 73 } 93 74 … … 105 86 } 106 87 107 // virtual function used by back end class SpaceShip. 108 float TutorialShip::getReloadTime() 109 { 110 return this->reloadTime_; 111 } 88 /*** NOT SO IMPORTATANT... ***/ 112 89 113 90 // run time update method. Gets called every frame with the delta time that … … 119 96 } 120 97 98 // virtual function used by back end class SpaceShip. 99 float TutorialShip::getReloadTime() 100 { 101 return this->reloadTime_; 102 } 103 121 104 // Fire a projectile. Delegated to the back end class SpaceShip. 122 105 // Function content is insignificant for the tutorial.
Note: See TracChangeset
for help on using the changeset viewer.