Changeset 645 for code/branches/FICN/src/orxonox/objects/Fighter.cc
- Timestamp:
- Dec 19, 2007, 3:05:56 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/objects/Fighter.cc
r637 r645 55 55 this->ammoDump_ = NULL; 56 56 this->mainWeapon_ = NULL; 57 this->rightButtonPressed_ = false; 58 this->leftButtonPressed_ = false; 57 59 58 60 this->moveForward_ = 0; … … 114 116 Model::loadParams(xmlElem); 115 117 118 #if 0 116 119 w = new particle::ParticleInterface(Orxonox::getSingleton()->getSceneManager(),"schuss" + this->getName(),"Orxonox/schuss"); 117 120 w->getParticleSystem()->setParameter("local_space","true"); … … 131 134 node1->setInheritScale(false); 132 135 w->addToSceneNode(node1); 133 134 136 #endif 135 137 136 138 tt = new particle::ParticleInterface(Orxonox::getSingleton()->getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow"); … … 151 153 tt->addToSceneNode(node2); 152 154 153 154 155 // add weapon 155 156 … … 160 161 mainWeapon_ = new BarrelGun(); 161 162 mainWeapon_->setAmmoDump(ammoDump_); 163 Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->removeChild(mainWeapon_->getNode()); 164 getNode()->addChild(mainWeapon_->getNode()); 162 165 163 166 if (xmlElem->Attribute("forward") && xmlElem->Attribute("rotateupdown") && xmlElem->Attribute("rotaterightleft") && xmlElem->Attribute("looprightleft")) … … 216 219 bool Fighter::mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id ) 217 220 { 218 221 if (id == OIS::MB_Left) 222 { 223 this->leftButtonPressed_ = true; 224 } 225 else if (id == OIS::MB_Right) 226 this->rightButtonPressed_ = true; 227 return true; 228 } 229 230 bool Fighter::mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButtonID id ) 231 { 232 if (id == OIS::MB_Left) 233 { 234 this->leftButtonPressed_ = false; 235 } 236 else if (id == OIS::MB_Right) 237 this->rightButtonPressed_ = false; 219 238 return true; 220 239 } … … 239 258 mMouse->capture(); 240 259 260 if (leftButtonPressed_) 261 mainWeapon_->primaryFireRequest(); 262 if (rightButtonPressed_) 263 mainWeapon_->secondaryFireRequest(); 264 241 265 if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W)) 242 266 this->moveForward(speed); … … 256 280 if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A)) 257 281 this->loopLeft(loop); 282 else 283 this->loopLeft(0); 284 285 if (mKeyboard->isKeyDown(OIS::KC_G)) 286 this->mainWeapon_->addAction(BaseWeapon::RELOAD); 258 287 else 259 288 this->loopLeft(0);
Note: See TracChangeset
for help on using the changeset viewer.