Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10135 in orxonox.OLD for branches/ai/src/world_entities


Ignore:
Timestamp:
Dec 20, 2006, 7:47:45 PM (18 years ago)
Author:
tfahrni
Message:
 
Location:
branches/ai/src/world_entities/npcs
Files:
2 edited

Legend:

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

    r10112 r10135  
    1919
    2020#include "npc_test.h"
    21 
     21#include <stdio.h>
    2222
    2323#include "state.h"
     
    3434#include "movement_module.h"
    3535#include "ai_module.h"
    36 
     36#include "ai_team.h"
     37#include "ai_swarm.h"
     38#include "ai_engine.h"
    3739
    3840ObjectListDefinitionID(NPC2, CL_NPC_TEST2);
     
    4345{
    4446        this->registerObject(this, NPC2::_objectList);
    45         if (root != NULL)this->loadParams(root);
    46        
    47         this->aiModule=new MovementModule(this);
     47
     48        if (root != NULL)
     49                this->loadParams(root);
     50
     51        std::cout << "Team Number: " << teamNumber << "\n";
     52        std::cout << "Swarm Number:" << swarmNumber << "\n";
     53
     54        AITeam* myTeam=AIEngine::getInstance()->getCreateTeam(teamNumber);
     55        //std::cout << "Testpoint 4: " << myTeam << "\n";
     56        AISwarm* mySwarm=myTeam->getCreateSwarm(swarmNumber);
     57        //std::cout << "Testpoint 5: " << mySwarm << "\n";
     58        mySwarm->addToSwarm(new MovementModule(this));
     59
    4860}
    4961
    50 
    51 NPC2::~NPC2 ()
    52 {}
    5362
    5463
     
    5665{
    5766  NPC::loadParams(root);
     67
     68  LoadParam(root, "team", this, NPC2, setTeamNumber)
     69                .describe("this sets the team number")
     70                .defaultValues(0);
     71
     72  LoadParam(root, "swarm", this, NPC2, setSwarmNumber)
     73                .describe("this sets the swarm number")
     74                .defaultValues(0);
    5875}
    5976
     
    6582        if( likely(this->getModel(0) != NULL) && this->getModel(0)->isA(MD2Model::staticClassID()))
    6683                ((MD2Model*)this->getModel(0))->tick(dt);
    67 
    68         // processing AI
    69         //PRINTF(0)("Processing NPC\n");
    70         if(this->aiModule!=NULL)this->aiModule->process(dt);
    7184}
    7285
  • branches/ai/src/world_entities/npcs/npc_test.h

    r10112 r10135  
    1111
    1212class NPC2 : public NPC {
    13   ObjectListDeclaration(NPC2);
     13        ObjectListDeclaration(NPC2);
    1414
    15  public:
    16   NPC2 (const TiXmlElement* root);
    17   virtual ~NPC2 ();
    18   virtual void loadParams(const TiXmlElement* root);
    19   virtual void tick(float dt);
     15        public:
     16                NPC2 (const TiXmlElement* root);
     17                virtual ~NPC2 (){};
     18                virtual void loadParams(const TiXmlElement* root);
     19                virtual void tick(float dt);
    2020
    21         int team;
    22         int swarm;
    23         int difficulty;
    24         AIModule* aiModule;
     21
     22        private:
     23                inline void setTeamNumber(int number){teamNumber=number;}
     24                inline void setSwarmNumber(int number){swarmNumber=number;}
     25
     26                int teamNumber;
     27                int swarmNumber;
     28                int difficulty;
     29
     30                AIModule* aiModule;
    2531};
    2632
Note: See TracChangeset for help on using the changeset viewer.