Changeset 190 for code/branches/main_reto/src/run_manager.cc
- Timestamp:
- Nov 7, 2007, 10:03:26 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/main_reto/src/run_manager.cc
r171 r190 52 52 #include "orxonox_ship.h" 53 53 #include "bullet.h" 54 #include "bullet_manager.h" 54 55 #include "camera_manager.h" 56 #include "weapon_manager.h" 57 #include "inertial_node.h" 55 58 56 59 #include "run_manager.h" … … 58 61 namespace orxonox { 59 62 using namespace Ogre; 63 using namespace weapon; 60 64 61 65 /** … … 97 101 // background scene (world objects, skybox, lights, etc.) 98 102 backgroundScene_ = new OrxonoxScene(sceneMgr_); 103 104 105 // BULLET LIST FOR THE TEST APPLICATION 106 107 // create a bullet manager 108 bulletManager_ = new BulletManager(sceneMgr_); 109 WeaponManager::loadWeapons(); 110 111 // TODO: Use STL to make life easier. But it works this way too.. 112 /*bullets_ = new Bullet*[10]; 113 bulletsIndex_ = 0; 114 bulletsSize_ = 10;*/ 115 99 116 100 117 // PLAYER SPACESHIP … … 114 131 // Construct a new spaceship and give it the node 115 132 playerShip_ = new OrxonoxShip(sceneMgr_, sceneMgr_->getRootSceneNode() 116 ->createChildSceneNode("ShipNode", Vector3(20, 20, 20)) );133 ->createChildSceneNode("ShipNode", Vector3(20, 20, 20)), bulletManager_); 117 134 118 135 … … 140 157 141 158 142 // BULLET LIST FOR THE TEST APPLICATION143 144 // TODO: Use STL to make life easier. But it works this way too..145 bullets_ = new Bullet*[10];146 bulletsIndex_ = 0;147 bulletsSize_ = 10;148 149 159 150 160 // HUMAN INTERFACE … … 205 215 if (playerShip_) 206 216 delete playerShip_; 217 if (bulletManager_) 218 delete bulletManager_; 219 220 WeaponManager::destroyWeapons(); 207 221 208 222 // clean up the bullet list 209 for (int i = 0; i < bulletsIndex_; i++)223 /*for (int i = 0; i < bulletsIndex_; i++) 210 224 delete bullets_[i]; 211 delete bullets_; 225 delete bullets_;*/ 212 226 } 213 227 … … 239 253 240 254 // update the bullet positions 241 for (int i = 0; i < bulletsIndex_; i++) 255 bulletManager_->tick(time, deltaTime); 256 257 /*for (int i = 0; i < bulletsIndex_; i++) 242 258 { 243 259 bullets_[i]->node_->translate(bullets_[i]->speed_*deltaTime); 244 260 bullets_[i]->node_->yaw(Degree(deltaTime*100)); 245 261 bullets_[i]->node_->roll(Degree(deltaTime*300)); 246 } 262 }*/ 247 263 248 264 // HUMAN INTERFACE … … 447 463 // Prevent continuous fire for the moment. 448 464 leftButtonDown_ = true; 465 466 playerShip_->fire(); 449 467 450 468 // let ship fire one shot with its only weapon (Barrels..) 451 Bullet *tempBullet = playerShip_->fire();469 /*Bullet *tempBullet = playerShip_->fire(); 452 470 453 471 // resize array if neccessary (double the size then) … … 464 482 465 483 // add the bullet to the list 466 bullets_[bulletsIndex_++] = tempBullet; 484 bullets_[bulletsIndex_++] = tempBullet;*/ 467 485 468 486 } … … 556 574 { 557 575 camera_ = sceneMgr_->createCamera("PlayerCam"); 558 playerShip_->getRootNode()-> attachObject(camera_);576 playerShip_->getRootNode()->getSceneNode()->attachObject(camera_); 559 577 camera_->setNearClipDistance(5); 560 578 camera_->setPosition(Vector3(0,10,500));
Note: See TracChangeset
for help on using the changeset viewer.