Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10725 in orxonox.OLD


Ignore:
Timestamp:
Jun 19, 2007, 11:59:25 PM (17 years ago)
Author:
rennerc
Message:

actionboxenemy

Location:
branches/presentation/src/world_entities/npcs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/world_entities/npcs/actionbox_enemy.cc

    r10713 r10725  
    5151 
    5252  this->onEscape = false;
    53  
     53  this->escaped = false;
     54  this->endPoint = Vector(0, 0, 0);
    5455  if ( root )
    5556    this->loadParams( root );
     
    9798  this->weaponMan.getFixedTarget()->setRelCoor(100000,0,0);
    9899  this->weaponMan.hideCrosshair();
     100 
     101  if ( root )
     102  {
     103    this->loadParams( root );
     104  }
    99105}
    100106
     
    106112{
    107113  WorldEntity::loadParams( root );
     114 
     115  LoadParam(root, "endPoint", this, ActionboxEnemy, setEndPoint);
    108116}
    109117
    110118void ActionboxEnemy::tick( float dt )
    111119{
     120  if ( escaped )
     121  {
     122    moveTowards( endPoint, endPoint - this->getAbsCoor(), dt );
     123    return;
     124  }
     125 
    112126  weaponMan.tick( dt );
    113127  this->bFire = false;
     
    122136 
    123137  if ( behindPlayer )
     138  {
     139    this->escaped = true;
     140    PRINTF(0)("MOVING TOWARDS ENDPOINT\n");
    124141    return;
     142  }
    125143 
    126144  myDir = this->getAbsDir();
     
    189207    onEscape = true;
    190208   
    191     Vector rEscapePoint = box->getAbsDir().apply(escapePoint);
     209    Vector rEscapePoint = box->getAbsDir().apply(escapePoint + Vector( -10, 0, 0 ));
    192210    Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor() + rEscapePoint;
    193211    Vector targetDir = State::getPlayer()->getPlayable()->getAbsCoor() + rEscapePoint - this->getAbsCoor();
    194     moveTowards( targetPos, targetDir, dt );   
     212    moveTowards( targetPos, targetDir, dt );
    195213  }
    196214}
  • branches/presentation/src/world_entities/npcs/actionbox_enemy.h

    r10712 r10725  
    3939    Vector     escapePoint;
    4040    bool       onEscape;
     41    bool       escaped;
     42    Vector     endPoint;
     43   
     44    void setEndPoint( float x, float y, float z ){ endPoint = Vector(x, y, z); }
    4145   
    4246    void attackPlayer( ActionBox* box, float dt );
Note: See TracChangeset for help on using the changeset viewer.