Changeset 4893 in orxonox.OLD for orxonox/trunk/src/world_entities/weapons/weapon.cc
- Timestamp:
- Jul 19, 2005, 5:16:07 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/weapons/weapon.cc
r4892 r4893 126 126 } 127 127 128 129 /** 130 * creates an Animation3D for a certain State. 131 * @param state what state should the Animation be created for 132 * @param node the node this Animation should apply to. 133 * @returns The created animation.Animation(), NULL on error. 134 * 135 * This function does only generate the Animation Object, and if set it will 136 * automatically be executed, when a certain State is reached. 137 * What this does not do, is set keyframes, you have to operate on the returned animation. 138 */ 139 Animation3D* Weapon::createAnimation(WeaponState state, PNode* node) 140 { 141 if (state >= WS_STATE_COUNT || node == NULL) 142 return NULL; 143 144 if (unlikely(this->animation[state] != NULL)) 145 { 146 delete this->animation[state]; 147 this->animation[state] = NULL; 148 } 149 return this->animation[state] = new Animation3D(node); 150 } 151 152 128 153 ///////////////// 129 154 // EXECUTION // … … 219 244 { 220 245 // play Sound 221 if ( this->soundBuffers[WA_ACTIVATE] != NULL)246 if (likely(this->soundBuffers[WA_ACTIVATE] != NULL)) 222 247 this->soundSource->play(this->soundBuffers[WA_ACTIVATE]); 248 if (likely(this->animation[WS_ACTIVATING] != NULL)) 249 this->animation[WS_ACTIVATING]->replay(); 223 250 // activate 224 251 PRINTF(5)("Activating the Weapon %s\n", this->getName()); … … 243 270 if (this->soundBuffers[WA_DEACTIVATE] != NULL) 244 271 this->soundSource->play(this->soundBuffers[WA_DEACTIVATE]); 272 if (likely(this->animation[WS_DEACTIVATING] != NULL)) 273 this->animation[WS_DEACTIVATING]->replay(); 245 274 // deactivate 246 275 this->deactivate(); … … 263 292 if (this->soundBuffers[WA_CHARGE] != NULL) 264 293 this->soundSource->play(this->soundBuffers[WA_CHARGE]); 294 if (likely(this->animation[WS_CHARGING] != NULL)) 295 this->animation[WS_CHARGING]->replay(); 296 265 297 // charge 266 298 this->charge(); … … 289 321 if (this->soundBuffers[WA_SHOOT] != NULL) 290 322 this->soundSource->play(this->soundBuffers[WA_SHOOT]); 323 if (likely(this->animation[WS_SHOOTING] != NULL)) 324 this->animation[WS_SHOOTING]->replay(); 291 325 // fire 292 326 this->fire(); … … 321 355 if (this->soundBuffers[WA_RELOAD] != NULL) 322 356 this->soundSource->play(this->soundBuffers[WA_RELOAD]); 357 if (likely(this->animation[WS_RELOADING] != NULL)) 358 this->animation[WS_RELOADING]->replay(); 323 359 324 360 if (chargeSize > this->energy)
Note: See TracChangeset
for help on using the changeset viewer.