Changeset 10725 in orxonox.OLD for branches/presentation/src/world_entities
- Timestamp:
- Jun 19, 2007, 11:59:25 PM (18 years ago)
- 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 51 51 52 52 this->onEscape = false; 53 53 this->escaped = false; 54 this->endPoint = Vector(0, 0, 0); 54 55 if ( root ) 55 56 this->loadParams( root ); … … 97 98 this->weaponMan.getFixedTarget()->setRelCoor(100000,0,0); 98 99 this->weaponMan.hideCrosshair(); 100 101 if ( root ) 102 { 103 this->loadParams( root ); 104 } 99 105 } 100 106 … … 106 112 { 107 113 WorldEntity::loadParams( root ); 114 115 LoadParam(root, "endPoint", this, ActionboxEnemy, setEndPoint); 108 116 } 109 117 110 118 void ActionboxEnemy::tick( float dt ) 111 119 { 120 if ( escaped ) 121 { 122 moveTowards( endPoint, endPoint - this->getAbsCoor(), dt ); 123 return; 124 } 125 112 126 weaponMan.tick( dt ); 113 127 this->bFire = false; … … 122 136 123 137 if ( behindPlayer ) 138 { 139 this->escaped = true; 140 PRINTF(0)("MOVING TOWARDS ENDPOINT\n"); 124 141 return; 142 } 125 143 126 144 myDir = this->getAbsDir(); … … 189 207 onEscape = true; 190 208 191 Vector rEscapePoint = box->getAbsDir().apply(escapePoint );209 Vector rEscapePoint = box->getAbsDir().apply(escapePoint + Vector( -10, 0, 0 )); 192 210 Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor() + rEscapePoint; 193 211 Vector targetDir = State::getPlayer()->getPlayable()->getAbsCoor() + rEscapePoint - this->getAbsCoor(); 194 moveTowards( targetPos, targetDir, dt ); 212 moveTowards( targetPos, targetDir, dt ); 195 213 } 196 214 } -
branches/presentation/src/world_entities/npcs/actionbox_enemy.h
r10712 r10725 39 39 Vector escapePoint; 40 40 bool onEscape; 41 bool escaped; 42 Vector endPoint; 43 44 void setEndPoint( float x, float y, float z ){ endPoint = Vector(x, y, z); } 41 45 42 46 void attackPlayer( ActionBox* box, float dt );
Note: See TracChangeset
for help on using the changeset viewer.