- Timestamp:
- Dec 12, 2008, 4:39:13 AM (16 years ago)
- Location:
- code/branches/objecthierarchy2/src/orxonox/objects/worldentities/pawns
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy2/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2369 r2414 37 37 #include "objects/gametypes/Gametype.h" 38 38 #include "objects/weaponSystem/WeaponSystem.h" 39 #include "objects/worldentities/ParticleSpawner.h" 40 #include "objects/worldentities/ExplosionChunk.h" 39 41 40 42 namespace orxonox … … 56 58 this->lastHitOriginator_ = 0; 57 59 this->weaponSystem_ = 0; 60 61 this->spawnparticleduration_ = 3.0f; 58 62 59 63 /* … … 87 91 XMLPortParam(Pawn, "maxhealth", setMaxHealth, getMaxHealth, xmlelement, mode).defaultValues(200); 88 92 XMLPortParam(Pawn, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100); 93 XMLPortParam(Pawn, "spawnparticlesource", setSpawnParticleSource, getSpawnParticleSource, xmlelement, mode); 94 XMLPortParam(Pawn, "spawnparticleduration", setSpawnParticleDuration, getSpawnParticleDuration, xmlelement, mode).defaultValues(3.0f); 95 XMLPortParam(Pawn, "explosionchunks", setExplosionChunks, getExplosionChunks, xmlelement, mode).defaultValues(7); 89 96 } 90 97 … … 133 140 } 134 141 135 void Pawn::spawn ()142 void Pawn::spawneffect() 136 143 { 137 144 // play spawn effect 145 if (this->spawnparticlesource_ != "") 146 { 147 ParticleSpawner* effect = new ParticleSpawner(this); 148 effect->setPosition(this->getPosition()); 149 effect->setOrientation(this->getOrientation()); 150 effect->setDestroyAfterLife(true); 151 effect->setSource(this->spawnparticlesource_); 152 effect->setLifetime(this->spawnparticleduration_); 153 } 138 154 } 139 155 … … 151 167 this->getPlayer()->stopControl(this); 152 168 169 this->deatheffect(); 170 } 171 172 void Pawn::deatheffect() 173 { 153 174 // play death effect 175 { 176 ParticleSpawner* effect = new ParticleSpawner(this); 177 effect->setPosition(this->getPosition()); 178 effect->setOrientation(this->getOrientation()); 179 effect->setDestroyAfterLife(true); 180 effect->setSource("Orxonox/explosion2"); 181 effect->setLifetime(4.0f); 182 } 183 { 184 ParticleSpawner* effect = new ParticleSpawner(this); 185 effect->setPosition(this->getPosition()); 186 effect->setOrientation(this->getOrientation()); 187 effect->setDestroyAfterLife(true); 188 effect->setSource("Orxonox/smoke6"); 189 effect->setLifetime(4.0f); 190 } 191 { 192 ParticleSpawner* effect = new ParticleSpawner(this); 193 effect->setPosition(this->getPosition()); 194 effect->setOrientation(this->getOrientation()); 195 effect->setDestroyAfterLife(true); 196 effect->setSource("Orxonox/sparks"); 197 effect->setLifetime(4.0f); 198 } 199 for (unsigned int i = 0; i < this->numexplosionchunks_; ++i) 200 { 201 ExplosionChunk* chunk = new ExplosionChunk(this); 202 chunk->setPosition(this->getPosition()); 203 204 } 154 205 } 155 206 … … 163 214 { 164 215 this->setHealth(this->initialHealth_); 165 this->spawn ();216 this->spawneffect(); 166 217 } 167 218 -
code/branches/objecthierarchy2/src/orxonox/objects/worldentities/pawns/Pawn.h
r2369 r2414 82 82 { return (WorldEntity*)this; } 83 83 84 inline void setSpawnParticleSource(const std::string& source) 85 { this->spawnparticlesource_ = source; } 86 inline const std::string& getSpawnParticleSource() const 87 { return this->spawnparticlesource_; } 88 89 inline void setSpawnParticleDuration(float duration) 90 { this->spawnparticleduration_ = duration; } 91 inline float getSpawnParticleDuration() const 92 { return this->spawnparticleduration_; } 93 94 inline void setExplosionChunks(unsigned int chunks) 95 { this->numexplosionchunks_ = chunks; } 96 inline unsigned int getExplosionChunks() const 97 { return this->numexplosionchunks_; } 98 84 99 protected: 85 virtual void spawn();86 100 virtual void death(); 101 virtual void deatheffect(); 102 virtual void spawneffect(); 87 103 88 104 bool bAlive_; … … 95 111 96 112 WeaponSystem* weaponSystem_; 113 114 std::string spawnparticlesource_; 115 float spawnparticleduration_; 116 unsigned int numexplosionchunks_; 97 117 }; 98 118
Note: See TracChangeset
for help on using the changeset viewer.