Changeset 8514 in orxonox.OLD
- Timestamp:
- Jun 16, 2006, 1:36:30 AM (18 years ago)
- Location:
- branches/bsp_model/src
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/defs/class_id.h
r8508 r8514 219 219 CL_NPC_TEST1 = 0x00000401, 220 220 CL_NPC_TEST2 = 0x00000402, 221 CL_GENERIC_NPC = 0x00000403, 221 222 222 223 // Testing Entities -
branches/bsp_model/src/world_entities/WorldEntities.am
r8490 r8514 4 4 world_entities/npcs/npc_test.cc \ 5 5 world_entities/npcs/ground_turret.cc \ 6 world_entities/npcs/generic_npc.cc \ 6 7 \ 7 8 world_entities/environment.cc \ -
branches/bsp_model/src/world_entities/npcs/ground_turret.cc
r7954 r8514 39 39 */ 40 40 GroundTurret::GroundTurret(const TiXmlElement* root) 41 : NPC(root) 41 42 { 42 43 this->init(); -
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 -
branches/bsp_model/src/world_entities/npcs/npc.h
r6981 r8514 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 -
branches/bsp_model/src/world_entities/npcs/npc_test.cc
r6222 r8514 31 31 32 32 NPC2::NPC2() 33 : NPC(NULL) 33 34 { 34 35 this->setClassID(CL_NPC_TEST2, "NPC2"); -
branches/bsp_model/src/world_entities/npcs/npc_test1.cc
r6222 r8514 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.