Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10275 in orxonox.OLD for branches/ai/src/world_entities/npcs/npc.cc


Ignore:
Timestamp:
Jan 17, 2007, 7:05:42 PM (17 years ago)
Author:
tfahrni
Message:

npc can shoot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ai/src/world_entities/npcs/npc.cc

    r10268 r10275  
    2424#include "ai_engine.h"
    2525
     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"
    2634#include "debug.h"
    27 
    2835#include "loading/load_param.h"
    2936
     
    3239
    3340ObjectListDefinition(NPC);
     41CREATE_FACTORY(NPC);
     42
    3443
    3544NPC::NPC(const TiXmlElement* root)
     
    3847  this->registerObject(this, NPC::_objectList);
    3948
    40   this->toList(OM_GROUP_00);
     49  this->toList(OM_GROUP_01);
     50
     51  if( root != NULL)
     52          this->loadParams(root);
    4153
    4254  std::cout << "Team Number: " << teamNumber << "\n";
    4355  std::cout << "Swarm Number:" << swarmNumber << "\n";
    44   //aiModule=new MovementModule(this);
    45   //AIEngine::getInstance()->addAI(teamNumber,swarmNumber,aiModule);
     56
    4657  AIEngine::getInstance()->addAI(teamNumber,swarmNumber,(WorldEntity*)this);
    4758
    4859  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);
    49109
    50110}
     
    138198void NPC::tick(float dt)
    139199{
     200        //std::cout << "fire..\n";
    140201  this->weaponMan.tick(dt);
    141202  if (this->bFire)
Note: See TracChangeset for help on using the changeset viewer.