Changeset 10275 in orxonox.OLD for branches/ai/src/world_entities
- Timestamp:
- Jan 17, 2007, 7:05:42 PM (18 years ago)
- Location:
- branches/ai/src/world_entities/npcs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ai/src/world_entities/npcs/npc.cc
r10268 r10275 24 24 #include "ai_engine.h" 25 25 26 #include "player.h" 27 #include "playable.h" 28 29 #include "weapons/test_gun.h" 30 #include "weapons/turret.h" 31 #include "weapons/cannon.h" 32 33 #include "loading/factory.h" 26 34 #include "debug.h" 27 28 35 #include "loading/load_param.h" 29 36 … … 32 39 33 40 ObjectListDefinition(NPC); 41 CREATE_FACTORY(NPC); 42 34 43 35 44 NPC::NPC(const TiXmlElement* root) … … 38 47 this->registerObject(this, NPC::_objectList); 39 48 40 this->toList(OM_GROUP_00); 49 this->toList(OM_GROUP_01); 50 51 if( root != NULL) 52 this->loadParams(root); 41 53 42 54 std::cout << "Team Number: " << teamNumber << "\n"; 43 55 std::cout << "Swarm Number:" << swarmNumber << "\n"; 44 //aiModule=new MovementModule(this); 45 //AIEngine::getInstance()->addAI(teamNumber,swarmNumber,aiModule); 56 46 57 AIEngine::getInstance()->addAI(teamNumber,swarmNumber,(WorldEntity*)this); 47 58 48 59 this->bFire = false; 60 61 62 // create the weapons and their manager 63 64 65 this->getWeaponManager().changeWeaponConfig(1); 66 Weapon* wpRight = new TestGun(0); 67 wpRight->setName("testGun Right"); 68 Weapon* wpLeft = new TestGun(1); 69 wpLeft->setName("testGun Left"); 70 71 wpRight->toList( this->getOMListNumber()); 72 wpLeft->toList( this->getOMListNumber()); 73 74 75 this->addWeapon(wpLeft, 1, 0); 76 this->addWeapon(wpRight,1 ,1); 77 78 wpLeft->increaseEnergy( 100); 79 wpRight->increaseEnergy( 100); 80 81 this->setHealthMax(100); 82 this->setHealth(80); 83 84 this->getWeaponManager().setSlotCount(7); 85 86 this->getWeaponManager().setSlotPosition(0, Vector(-2.6, .1, -3.0)); 87 this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 88 89 this->getWeaponManager().setSlotPosition(1, Vector(-2.6, .1, 3.0)); 90 this->getWeaponManager().setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 91 92 this->getWeaponManager().setSlotPosition(2, Vector(-1.5, .5, -.5)); 93 this->getWeaponManager().setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0))); 94 95 this->getWeaponManager().setSlotPosition(3, Vector(-1.5, .5, .5)); 96 this->getWeaponManager().setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0))); 97 98 this->getWeaponManager().setSlotPosition(4, Vector(-1.5, -.5, .5)); 99 this->getWeaponManager().setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0))); 100 101 this->getWeaponManager().setSlotPosition(5, Vector(-1.5, -.5, -.5)); 102 this->getWeaponManager().setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0))); 103 104 this->getWeaponManager().setSlotPosition(6, Vector(-1, 0.0, 0)); 105 this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 106 107 this->getWeaponManager().getFixedTarget()->setParent(this); 108 this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0); 49 109 50 110 } … … 138 198 void NPC::tick(float dt) 139 199 { 200 //std::cout << "fire..\n"; 140 201 this->weaponMan.tick(dt); 141 202 if (this->bFire) -
branches/ai/src/world_entities/npcs/npc.h
r10268 r10275 17 17 virtual ~NPC (); 18 18 19 virtual void loadParams(const TiXmlElement* root = NULL);19 virtual void loadParams(const TiXmlElement* root); 20 20 21 21 … … 29 29 virtual void tick(float dt); 30 30 inline int getTeam() { return teamNumber; } 31 inline void fire(){ this->bFire=true;} 31 32 32 inline void fire() { this->bFire = true; }33 33 34 34 -
branches/ai/src/world_entities/npcs/npc_test.cc
r10269 r10275 52 52 53 53 // create the weapons and their manager 54 this->addWeapon(wpLeft, 1, 0); 55 this->addWeapon(wpRight,1 ,1); 56 \ 54 55 57 56 this->getWeaponManager().changeWeaponConfig(1); 58 57 Weapon* wpRight = new TestGun(0); … … 60 59 Weapon* wpLeft = new TestGun(1); 61 60 wpLeft->setName("testGun Left"); 61 62 this->addWeapon(wpLeft, 1, 0); 63 this->addWeapon(wpRight,1 ,1); 62 64 63 65 this->setHealthMax(100);
Note: See TracChangeset
for help on using the changeset viewer.