Changeset 8724 in orxonox.OLD for trunk/src/world_entities/npcs
- Timestamp:
- Jun 22, 2006, 3:14:58 PM (19 years ago)
- Location:
- trunk/src/world_entities/npcs
- Files:
-
- 5 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/npcs/ground_turret.cc
r7954 r8724 39 39 */ 40 40 GroundTurret::GroundTurret(const TiXmlElement* root) 41 : NPC(root) 41 42 { 42 43 this->init(); -
trunk/src/world_entities/npcs/npc.cc
r7076 r8724 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 -
trunk/src/world_entities/npcs/npc.h
r6981 r8724 4 4 5 5 #include "world_entity.h" 6 #include "physics_interface.h"7 6 8 7 class AI; … … 11 10 12 11 public: 13 NPC ();12 NPC (const TiXmlElement* root); 14 13 virtual ~NPC (); 15 14 15 virtual void loadParams(const TiXmlElement* root = NULL); 16 16 17 17 void addAI(AI* ai); 18 19 virtual void collidesWith (WorldEntity* entity, const Vector& location);20 18 21 19 22 20 private: 23 21 24 WorldEntity* collider;25 26 22 }; 27 23 -
trunk/src/world_entities/npcs/npc_test.cc
r6222 r8724 31 31 32 32 NPC2::NPC2() 33 : NPC(NULL) 33 34 { 34 35 this->setClassID(CL_NPC_TEST2, "NPC2"); -
trunk/src/world_entities/npcs/npc_test1.cc
r6222 r8724 29 29 30 30 NPCTest1::NPCTest1() 31 : NPC(NULL) 31 32 { 32 33 this->setClassID(CL_NPC_TEST1, "NPCTest1");
Note: See TracChangeset
for help on using the changeset viewer.