- Timestamp:
- Dec 12, 2008, 4:39:13 AM (16 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.