Changeset 8183
- Timestamp:
- Apr 4, 2011, 2:14:25 PM (14 years ago)
- Location:
- code/branches/gameimmersion
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw
r8152 r8183 44 44 45 45 reloadrate= "10" 46 reloadwaittime= 5 46 47 47 48 > -
code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc
r8152 r8183 94 94 } 95 95 96 //////////////////////////me edit 96 97 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 97 98 { … … 103 104 this->bDestroy_ = true; 104 105 105 Pawn* victim = orxonox_cast<Pawn*>(otherObject); 106 Pawn* victim = orxonox_cast<Pawn*>(otherObject); //if otherObject isn't a Pawn, then victim is NULL 106 107 107 108 if (this->owner_) 108 109 { 109 if ( victim && !victim->hasShield())110 if (!victim || (victim && !victim->hasShield())) //same like below 110 111 { 111 112 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator()); … … 116 117 effect->setLifetime(2.0f); 117 118 } 118 if ( victim && !victim->hasShield())119 if (!victim || (victim && !victim->hasShield())) //same like above 119 120 { 120 121 ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator()); … … 137 138 138 139 if (victim) 140 { 139 141 victim->hit(this->owner_, contactPoint, this->damage_); 142 victim->startReloadCountdown(); 143 } 140 144 } 141 145 return false; 142 146 } 147 //////////////////////////////////////////////////////////////////////end edit 143 148 144 149 void Projectile::setOwner(Pawn* owner) -
code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc
r8152 r8183 68 68 this->shieldHealth_ = 0; 69 69 this->shieldAbsorption_ = 0.5; 70 ////////////////////////me 71 this->reloadRate_ = 0; 72 this->reloadWaitTime_ = 1.0f; 73 this->reloadWaitCountdown_ = 0; 74 ////////////////////////end me 70 75 71 76 this->lastHitOriginator_ = 0; … … 121 126 /////// me 122 127 XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0); 128 XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f); 123 129 124 130 /////// end me … … 144 150 145 151 ////////me 146 this->addShieldHealth(this->getReloadRate() * dt); 152 if(this->reloadWaitCountdown_ > 0) 153 { 154 this->decreaseReloadCountdownTime(dt); 155 } 156 else 157 { 158 this->addShieldHealth(this->getReloadRate() * dt); 159 this->resetReloadCountdown(); 160 } 161 147 162 // TODO max. shield hinzufuegen 148 163 ////////end me … … 185 200 } 186 201 202 void Pawn::setReloadWaitTime(float reloadwaittime) 203 { 204 this->reloadWaitTime_ = reloadwaittime; 205 COUT(2) << "RELOAD WAIT TIME SET TO " << this->reloadWaitTime_ << endl; 206 } 207 208 void Pawn::decreaseReloadCountdownTime(float dt) 209 { 210 this->reloadWaitCountdown_ -= dt; 211 } 212 187 213 188 214 ///////////////end me -
code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h
r8152 r8183 64 64 inline bool hasShield() 65 65 { return (this->getShieldHealth() > 0); } 66 67 virtual void setReloadWaitTime(float reloadwaittime); 68 inline float getReloadWaitTime() const 69 { return this->reloadWaitTime_; } 70 71 inline void resetReloadCountdown() 72 { this->reloadWaitCountdown_ = 0; } 73 74 inline void startReloadCountdown() 75 { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } //in projectile.cc einbauen!!!!!!1111!!111! 76 77 virtual void decreaseReloadCountdownTime(float dt); 66 78 67 79 ///////////////////////////////// end me … … 166 178 /////////////////////////// me 167 179 float reloadRate_; 180 float reloadWaitTime_; 181 float reloadWaitCountdown_; 168 182 169 183 ////////////////////////// end me
Note: See TracChangeset
for help on using the changeset viewer.