Changeset 10643 in orxonox.OLD for trunk/src/world_entities/npcs
- Timestamp:
- Apr 29, 2007, 6:51:28 PM (18 years ago)
- Location:
- trunk/src/world_entities/npcs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/npcs/mover.cc
r10618 r10643 82 82 .describe("sets the action time of the door") 83 83 .defaultValues(1.0); 84 LoadParam(root, "stay-open-time", this, Mover, setStayOpenTime) 85 .describe("sets the time, the door must stay open") 86 .defaultValues(0.0); 84 87 LoadParam(root, "opening-sound", this, Mover, setOpeningSoundFile) 85 88 .describe("Sets the file of the opening sound source"); … … 146 149 this->soundSource_moving.stop(); 147 150 } 151 this->openTime = 0; 148 152 } 149 153 else if (this->state == Open) 150 154 { 151 if (!this->checkPlayerInActionRadius()) 152 { 153 this->state = Closing; 154 if (this->soundBuffer_closing.loaded()) 155 this->soundSource_starting.play(this->soundBuffer_closing); 156 if (this->soundBuffer_moving.loaded()) 157 this->soundSource_moving.play(this->soundBuffer_moving, 1.0, true); 155 this->openTime += dt; 156 if (this->openTime >= this->stayOpenTime) 157 { 158 if (!this->checkPlayerInActionRadius()) 159 { 160 this->state = Closing; 161 if (this->soundBuffer_closing.loaded()) 162 this->soundSource_starting.play(this->soundBuffer_closing); 163 if (this->soundBuffer_moving.loaded()) 164 this->soundSource_moving.play(this->soundBuffer_moving, 1.0, true); 165 } 158 166 } 159 167 } -
trunk/src/world_entities/npcs/mover.h
r10487 r10643 35 35 void setActionRadius(float radius) { this->actionRadius = radius; } 36 36 void setActionTime(float time) { this->actionTime = time; } 37 void setStayOpenTime(float time) { this->stayOpenTime = time; } 37 38 void setOpeningSoundFile(const std::string& fileName); 38 39 void setOpenedSoundFile(const std::string& fileName); … … 62 63 float actionTime; //!< the action-time 63 64 int state; //!< the state of the mover 65 float stayOpenTime; //!< waiting time while opened 66 float openTime; //!< time since opened 64 67 }; 65 68
Note: See TracChangeset
for help on using the changeset viewer.