Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5826 in orxonox.OLD for trunk/src/world_entities/weapons


Ignore:
Timestamp:
Nov 29, 2005, 11:52:31 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: bomb detonation

Location:
trunk/src/world_entities/weapons
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/weapons/bomb.cc

    r5769 r5826  
    1717#include "glincl.h"
    1818#include "state.h"
     19#include "model.h"
     20#include "fast_factory.h"
    1921#include "list.h"
    20 #include "model.h"
    21 #include "vector.h"
    22 #include "fast_factory.h"
    2322
     23#include "object_manager.h"
    2424
    2525#include "particle_engine.h"
     
    114114      this->deactivate();
    115115    }
     116    if (this->lifeCycle > 0.9f)
     117      this->detonate ((this->lifeCycle-.89) *10000.0);
    116118}
    117119
     
    145147void Bomb::collidesWith (WorldEntity* entity, const Vector& location)
    146148{
    147         this->detonate();
     149  if (entity->isA(CL_NPC))
     150    this->lifeSpan = 0.9f;
    148151}
    149152
     
    160163}
    161164
    162 void Bomb::detonate()
     165void Bomb::detonate(float size)
    163166{
    164   tIterator<WorldEntity>* it = State::getWorldEntityList()->getIterator();
    165   WorldEntity* lm = it->firstElement();
    166 
    167   while(lm != NULL)
     167  std::list<WorldEntity*>* detonationList = ObjectManager::distanceFromObject(*this, size, CL_NPC);
     168  if (detonationList != NULL)
    168169  {
    169 
    170     lm = it->nextElement();
     170    while( !detonationList->empty() )
     171    {
     172    //detonationList->front()->collidesWith(this, Vector(0,0,0));
     173      detonationList->pop_front();
     174    }
     175    delete detonationList;
    171176  }
    172177}
  • trunk/src/world_entities/weapons/bomb.h

    r5750 r5826  
    3131  virtual void collidesWith (WorldEntity* entity, const Vector& location);
    3232  virtual void activate();
    33   virtual void detonate();
    3433  virtual void deactivate();
     34
     35  void detonate(float size);
    3536
    3637 private:
Note: See TracChangeset for help on using the changeset viewer.