Changeset 8514 in orxonox.OLD for branches/bsp_model/src/world_entities/npcs/npc.cc
- Timestamp:
- Jun 16, 2006, 1:36:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/world_entities/npcs/npc.cc
r7076 r8514 19 19 20 20 #include "npc.h" 21 #include "obb_tree.h"22 21 23 #include "state.h"24 #include "stdlibincl.h"25 #include "power_ups/turret_power_up.h"26 #include "power_ups/laser_power_up.h"27 22 28 23 using namespace std; 29 24 30 25 31 NPC::NPC( )26 NPC::NPC(const TiXmlElement* root) 32 27 { 33 28 this->setClassID(CL_NPC, "NPC"); 29 34 30 this->toList(OM_GROUP_00); 35 31 } … … 39 35 40 36 41 void NPC::collidesWith(WorldEntity* entity, const Vector& location)42 {43 37 44 if (entity == collider) 45 return; 46 collider = entity; 47 48 if (entity->isA(CL_PROJECTILE)) 49 { 50 this->decreaseHealth(entity->getHealth() *(float)rand()/(float)RAND_MAX); 51 // EXTREME HACK 52 if (this->getHealth() <= 0.0f) 53 { 54 this->destroy(); 55 } 56 } 38 /** 39 * adds an AI to this NPC 40 */ 41 void NPC::addAI(AI* ai) 42 {} 57 43 58 44 59 // // PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z); 60 // // this->applyForce(Vector(0,0,0)-location*1000); 61 // if ((float)rand()/RAND_MAX < .3) 62 // { 63 // WorldEntity* powerUp = new TurretPowerUp(); 64 // powerUp->setAbsCoor(this->getAbsCoor()); 65 // // powerUp->toList(OM_COMMON); 66 // } 67 // else if ((float)rand()/RAND_MAX < .3) 68 // { 69 // WorldEntity* powerUp = new LaserPowerUp(); 70 // powerUp->setAbsCoor(this->getAbsCoor()); 71 // powerUp->toList(OM_COMMON); 72 // } 73 // this->toList(OM_DEAD); 74 // this->removeNode(); 75 // 76 // this->collider = entity; 77 // } 78 // // else if (entity->isA(CL_PLAYER)) 79 // // this->applyForce(Vector(0,0,0)-location*100); 80 // else if (entity->isA(CL_NPC)) 81 // { 82 // this->setVisibiliy(false); 83 // this->toList(OM_DEAD); 84 // this->removeNode(); 85 // } 45 46 /** 47 * loads the xml tags 48 * @param root: root xml tag for this element 49 */ 50 void NPC::loadParams(const TiXmlElement* root) 51 { 52 WorldEntity::loadParams(root); 86 53 } 54
Note: See TracChangeset
for help on using the changeset viewer.