Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10439 in orxonox.OLD for trunk


Ignore:
Timestamp:
Jan 28, 2007, 1:58:29 PM (18 years ago)
Author:
snellen
Message:

npc is now trackable

Location:
trunk/src/world_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/npcs/npc.cc

    r10406 r10439  
    3434#include "debug.h"
    3535#include "loading/load_param.h"
     36#include "track/track.h"
    3637
    3738
     
    6465  std::cout << "Swarm Number:" << swarmNumber << "\n";
    6566
     67//add to track
     68  if(this->entityTrack)
     69    this->setParent(this->entityTrack->getTrackNode());
     70  else
    6671  AIEngine::getInstance()->addAI(teamNumber,swarmNumber,(WorldEntity*)this,maxSpeed,attackDistance);
    6772
     
    117122//   this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0);
    118123
     124
     125 
     126
    119127}
    120128
     
    122130NPC::~NPC ()
    123131{
     132 if(! this->entityTrack)
    124133  AIEngine::getInstance()->removeAI(teamNumber,swarmNumber,(WorldEntity*)this);
    125134}
     
    220229    weaponMan.fire();
    221230  this->bFire = false;
    222 }
     231
     232 if(this->entityTrack)
     233    this->entityTrack->tick(dt);
     234
     235}
  • trunk/src/world_entities/test_entity.cc

    r10368 r10439  
    2626#include "debug.h"
    2727
     28#include "track/track.h"
     29
    2830
    2931
     
    3739CREATE_FACTORY(TestEntity);
    3840
     41#include "script_class.h"
     42CREATE_SCRIPTABLE_CLASS(TestEntity,
     43                        addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     44                        ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     45                        ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
     46                        ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     47                        ->addMethod("setAbsDir", Executor4<PNode, lua_State*,float,float,float,float>(&PNode::setAbsDir))
     48                       );
    3949
    4050
     
    5363TestEntity::TestEntity(const TiXmlElement* root)
    5464{
    55   this->init();
    56 
    5765  if( root != NULL)
    5866    this->loadParams(root);
     67
     68  this->init();
    5969}
    6070
     
    7484  this->registerObject(this, TestEntity::_objectList);
    7585  this->toList(OM_GROUP_00);
     86
     87 //add to track
     88  if(this->entityTrack)
     89    this->setParent(this->entityTrack->getTrackNode());
     90
    7691}
    7792
     
    121136  glPopMatrix();
    122137  glPopAttrib();
     138
     139
     140if( this->entityTrack != NULL)
     141    this->entityTrack->drawGraph();
     142
    123143}
    124144
     
    128148void TestEntity::tick (float time)
    129149{
     150 if(this->entityTrack)
     151    this->entityTrack->tick(time);
    130152
    131153
Note: See TracChangeset for help on using the changeset viewer.