Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 25, 2011, 9:07:17 PM (13 years ago)
Author:
dafrick
Message:

Cleanup. Adding shield and boost shaking to Assff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc

    r8575 r8577  
    130130        XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
    131131        XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
    132 
    133         //TODO: DEFINES fuer defaultwerte (hier und weiter oben dieselben)
    134132    }
    135133
     
    227225    }
    228226
    229     /* Old damage function.
    230      * For effects causing only damage not specifically to shield or health
    231      */
    232     void Pawn::damage(float damage, Pawn* originator)
    233     {
    234         if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
    235         {
    236             //share the dealt damage to the shield and the Pawn.
    237             float shielddamage = damage*this->shieldAbsorption_;
    238             float healthdamage = damage*(1-this->shieldAbsorption_);
    239 
    240             // In case the shield can not take all the shield damage.
    241             if (shielddamage > this->getShieldHealth())
    242             {
    243                 healthdamage += shielddamage-this->getShieldHealth();
    244                 this->setShieldHealth(0);
    245             }
    246 
    247             this->setHealth(this->health_ - healthdamage);
    248 
    249             if (this->getShieldHealth() > 0)
    250             {
    251                 this->setShieldHealth(this->shieldHealth_ - shielddamage);
    252             }
    253 
    254             this->lastHitOriginator_ = originator;
    255 
    256             // play damage effect
    257         }
    258     }
    259 
    260     /* Does damage to the pawn, splits it up to shield and health.
    261      * Sets lastHitOriginator.
    262      */
    263227    void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
    264228    {
     
    284248
    285249            this->lastHitOriginator_ = originator;
    286 
    287             // play damage effect
    288         }
    289     }
    290 
    291 
     250        }
     251    }
     252
     253// TODO: Still valid?
    292254/* HIT-Funktionen
    293255    Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden! (Visuelle Effekte)
     
    295257*/
    296258
    297     /* Old hit function, calls the old damage function and changes velocity vector
    298      */
    299     void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
    300     {
    301         if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    302         {
    303             this->damage(damage, originator);
    304             this->setVelocity(this->getVelocity() + force);
    305 
    306             // play hit effect
    307         }
    308     }
    309 
    310     /* calls the damage function and adds the force that hit the pawn to the velocity vector
    311      */
    312259    void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
    313260    {
     
    316263            this->damage(damage, healthdamage, shielddamage, originator);
    317264            this->setVelocity(this->getVelocity() + force);
    318 
    319             // play hit effect
    320         }
    321     }
    322 
    323     /* Old hit (2) function, calls the old damage function and hits controller
    324      */
    325     void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
    326     {
    327         if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
    328         {
    329             this->damage(damage, originator);
    330 
    331             if ( this->getController() )
    332                 this->getController()->hit(originator, contactpoint, damage);
    333 
    334             // play hit effect
    335         }
    336     }
    337 
    338     /* Hit (2) function, calls the damage function and hits controller
    339      */
     265        }
     266    }
     267
     268
    340269    void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage)
    341270    {
     
    346275            if ( this->getController() )
    347276                this->getController()->hit(originator, contactpoint, damage); // changed to damage, why shielddamage?
    348 
    349             // play hit effect
    350277        }
    351278    }
Note: See TracChangeset for help on using the changeset viewer.