Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8511 in orxonox.OLD for branches


Ignore:
Timestamp:
Jun 16, 2006, 12:36:51 AM (18 years ago)
Author:
patrick
Message:

bsp: hit function reintroduced, now collision reaction should do better

Location:
branches/bsp_model/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/collision_reaction/cr_object_damage.cc

    r8490 r8511  
    6363  if( collision->isEntityACollide()) {
    6464    damage = collision->getEntityB()->getDamage();
    65     collision->getEntityA()->decreaseHealth(damage);
     65    collision->getEntityA()->hit(damage);
    6666  }
    6767  PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityA()->getClassName());
     
    6969  if( collision->isEntityBCollide()) {
    7070    damage = collision->getEntityA()->getDamage();
    71     collision->getEntityB()->decreaseHealth(damage);
     71    collision->getEntityB()->hit(damage);
    7272  }
    7373  PRINTF(4)("Dealing damage - %f damage to %s \n", damage, collision->getEntityB()->getClassName());
  • branches/bsp_model/src/world_entities/playable.cc

    r8490 r8511  
    376376    if (this->getHealth() <= 0.0f)
    377377    {
    378       this->die();
     378//       this->destory();
    379379
    380380      if( State::getGameRules() != NULL)
     
    411411
    412412
    413 void Playable::die()
     413
     414void Playable::destroy()
    414415{
    415416  Explosion::explode(dynamic_cast<PNode*>(this), Vector(1.0f, 1.0f, 1.0f));
  • branches/bsp_model/src/world_entities/playable.h

    r8055 r8511  
    7676
    7777  // WorldEntity Extensions
    78   virtual void die();
     78  virtual void destroy();
    7979  virtual void respawn();
    8080  virtual void collidesWith(WorldEntity* entity, const Vector& location);
  • branches/bsp_model/src/world_entities/world_entity.cc

    r8507 r8511  
    727727}
    728728
     729
     730/**
     731 * hit the world entity with
     732 *  @param damage damage to be dealt
     733 */
     734void WorldEntity::hit(float damage)
     735{
     736  this->decreaseHealth(damage);
     737
     738  if( this->getHealth() > 0)
     739  {
     740    // any small explosion animaitions
     741  }
     742  else
     743  {
     744    this->destroy();
     745
     746//     if( State::getGameRules() != NULL)
     747//       State::getGameRules()->registerKill(Kill(NULL, this));
     748  }
     749}
     750
     751
    729752/**
    730753 * @brief updates the HealthWidget
  • branches/bsp_model/src/world_entities/world_entity.h

    r8508 r8511  
    6161  virtual void postSpawn ();
    6262  virtual void leaveWorld ();
    63   virtual void destroy() {};
    6463
    6564  virtual void tick (float time);
     
    9594  CollisionHandle* getCollisionHandle(CREngine::CRType type) const { return this->collisionHandles[type]; }
    9695
     96  virtual void hit(float damage);
     97  virtual void destroy() {};
     98
    9799
    98100  /* @returns the Count of Faces on this WorldEntity */
     
    113115  /** @returns a Reference to the Iterator */
    114116  ObjectManager::EntityList::iterator& getEntityIterator() { return this->objectListIterator; }
    115 
    116   /* --- Network Block --- */
    117   int       writeState(const byte* data, int length, int sender);
    118   int       readState(byte* data, int maxLength );
    119117
    120118  /* --- Character Attribute Block --- */
Note: See TracChangeset for help on using the changeset viewer.