Changeset 9163 in orxonox.OLD for branches/presentation/src/world_entities
- Timestamp:
- Jul 4, 2006, 6:16:00 PM (18 years ago)
- Location:
- branches/presentation/src/world_entities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/world_entities/creatures/fps_player.cc
r9162 r9163 29 29 #include "weapons/cannon.h" 30 30 #include "weapons/fps_sniper_rifle.h" 31 #include "weapons/aiming_system.h" 31 32 32 33 #include "aabb.h" -
branches/presentation/src/world_entities/creatures/fps_player.h
r9162 r9163 9 9 10 10 #include "playable.h" 11 12 13 class AimingSystem; 11 14 12 15 … … 26 29 27 30 virtual void reset(); 28 31 29 32 virtual void destroy(WorldEntity* killer); 30 33 virtual void respawn(); … … 57 60 float fallVelocity; //!< velocity for falling down 58 61 float jumpForce; //!< the jump force 59 62 60 63 bool initWeapon; 64 65 AimingSystem* aimingSystem; //!< aiming system of the player 61 66 }; 62 67 -
branches/presentation/src/world_entities/weapons/aiming_system.cc
r9160 r9163 76 76 /** 77 77 * get back the nearest target 78 * @returns the nerest target 78 79 */ 79 80 inline WorldEntity* AimingSystem::getNearestTarget() … … 84 85 return this->selectionList.back(); 85 86 86 // WorldEntity* nearestEntity = this->; 87 WorldEntity* nearestEntity = this->selectionList.back(); 88 float distance = 0.0f; 89 float smalestDistance = this->range * 5.0f; 90 87 91 88 92 for( int i = 0; i < this->selectionList.size(); i++) 89 93 { 94 distance = fabs((this->getAbsCoor() - this->selectionList[i]->getAbsCoor()).len()); 95 if( distance < smalestDistance) 96 { 97 nearestEntity = this->selectionList[i]; 98 smalestDistance = distance; 99 } 100 } 90 101 91 }102 return nearestEntity; 92 103 } 93 104 … … 111 122 void AimingSystem::tick(float dt) 112 123 { 124 125 this->selectionList.clear(); 113 126 } 114 127
Note: See TracChangeset
for help on using the changeset viewer.