Changeset 8945 in orxonox.OLD for branches/single_player_map/src/world_entities
- Timestamp:
- Jun 30, 2006, 3:39:07 AM (19 years ago)
- Location:
- branches/single_player_map/src/world_entities/npcs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/single_player_map/src/world_entities/npcs/repair_station.cc
r8943 r8945 47 47 { 48 48 // begin, end, fps, interruptable 49 { 0, 12, 30, 0 }, //!< CYCLE0149 { 0, 12, 20, 0 }, //!< CYCLE01 50 50 { 12, 24, 30, 0 }, //!< CYCLE02 51 { 24, 40, 30, 0 }, //!< CYCLE0351 { 24, 40, 10, 0 }, //!< CYCLE03 52 52 { 40, 55, 30, 0 }, //!< CYCLE04 53 { 55, 68, 30, 0 }, //!< CYCLE0553 { 55, 68, 20, 0 }, //!< CYCLE05 54 54 { 68, 81, 30, 0 }, //!< CYCLE06 55 { 81, 89, 30, 0 }, //!< CYCLE0755 { 81, 89, 40, 0 }, //!< CYCLE07 56 56 { 89, 99, 30, 0 } //!< CYCLE08 57 57 }; … … 76 76 this->toList(OM_COMMON); 77 77 78 this->loadMD2Texture("maps/doors.jpg"); 79 this->loadModel("models/creatures/doors.md2", this->scale); 78 this->bActivated = true; 79 this->animationStep = 1; 80 this->animationCurrent = REPAIR_CYCLE01; 81 82 this->loadMD2Texture("maps/repairstation.jpg"); 83 this->loadModel("models/creatures/repairstation.md2", this->scale); 80 84 81 85 this->setAnimation(REPAIR_CYCLE01, MD2_ANIM_ONCE); … … 122 126 { 123 127 if( likely(this->getModel(0) != NULL)) 124 ((InteractiveModel*)this->getModel(0))->getAnimation(); 128 return ((InteractiveModel*)this->getModel(0))->getAnimation(); 129 else 130 return -1; 125 131 } 126 132 133 134 135 /** 136 * @returns true if animation is finished 137 */ 138 bool RepairStation::isAnimationFinished() 139 { 140 if( likely(this->getModel(0) != NULL)) 141 return ((InteractiveModel*)this->getModel(0))->isAnimationFinished(); 142 else 143 return false; 144 } 127 145 128 146 … … 133 151 { 134 152 this->animationStep = 1; 153 this->bActivated = true; 135 154 } 136 155 … … 142 161 { 143 162 this->animationStep = 0; 163 this->bActivated = false; 144 164 } 145 165 … … 163 183 ((InteractiveModel*)this->getModel(0))->tick(time); 164 184 165 if( this->getAnimation() == ATTACK)166 // ((MD2Model*)this->getModel(0))->setAnimation(ATTACK);185 if( !this->bActivated) 186 return; 167 187 168 169 this->setAnimation( this->animationCurrent, MD2_ANIM_ONCE); 170 this->animationCurrent = (this->animationCurrent + this->animationStep) % REPAIR_MAX_ANIMATIONS; 188 if( this->isAnimationFinished()) 189 { 190 this->animationCurrent = (this->animationCurrent + this->animationStep) % REPAIR_MAX_ANIMATIONS; 191 this->setAnimation( this->animationCurrent, MD2_ANIM_ONCE); 192 } 171 193 } 172 194 -
branches/single_player_map/src/world_entities/npcs/repair_station.h
r8943 r8945 46 46 void setAnimation(int animNum, int playbackMode = 0); 47 47 int getAnimation(); 48 bool isAnimationFinished(); 48 49 49 50 … … 56 57 int animationStep; //!< the incrementation step of the animation 57 58 59 bool bActivated; //!< true if activated 60 58 61 }; 59 62
Note: See TracChangeset
for help on using the changeset viewer.