Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jan 17, 2007, 4:27:43 PM (18 years ago)
Author:
patrick
Message:

ai is now handeled in npc, weapon manager added

File:
1 edited

Legend:

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

    r9869 r10263  
    1818
    1919
     20#include "movement_module.h"
     21#include "ai_module.h"
     22#include "ai_team.h"
     23#include "ai_swarm.h"
     24#include "ai_engine.h"
     25
     26#include "loading/load_param.h"
     27
     28
    2029#include "npc.h"
    2130
     
    2332
    2433NPC::NPC(const TiXmlElement* root)
     34  : weaponMan(this)
    2535{
    2636  this->registerObject(this, NPC::_objectList);
     
    2838  this->toList(OM_GROUP_00);
    2939
     40  std::cout << "Team Number: " << teamNumber << "\n";
     41  std::cout << "Swarm Number:" << swarmNumber << "\n";
     42  //aiModule=new MovementModule(this);
     43  //AIEngine::getInstance()->addAI(teamNumber,swarmNumber,aiModule);
     44  AIEngine::getInstance()->addAI(teamNumber,swarmNumber,(WorldEntity*)this);
     45
     46  this->bFire = false;
     47
    3048}
    3149
    3250
    33 NPC::~NPC () {}
    34 
    35 
    36 
    37 /**
    38  * adds an AI to this NPC
    39  */
    40 void NPC::addAI(AI* ai)
    41 {}
     51NPC::~NPC ()
     52{
     53  AIEngine::getInstance()->removeAI(teamNumber,swarmNumber,(WorldEntity*)this);
     54}
    4255
    4356
     
    5063{
    5164   WorldEntity::loadParams(root);
     65
     66  LoadParam(root, "team", this, NPC, setTeamNumber)
     67  .describe("this sets the team number")
     68  .defaultValues(0);
     69
     70  LoadParam(root, "swarm", this, NPC, setSwarmNumber)
     71  .describe("this sets the swarm number")
     72  .defaultValues(0);
    5273}
    5374
     75
     76void NPC::tick(float dt)
     77{
     78  this->weaponMan.tick(dt);
     79  if (this->bFire)
     80    weaponMan.fire();
     81}
Note: See TracChangeset for help on using the changeset viewer.