Changeset 9168 in orxonox.OLD for branches/presentation/src/world_entities/weapons
- Timestamp:
- Jul 4, 2006, 8:27:13 PM (19 years ago)
- Location:
- branches/presentation/src/world_entities/weapons
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/world_entities/weapons/aiming_system.cc
r9166 r9168 10 10 11 11 ### File Specific: 12 main-programmer: Benjamin Grauer12 main-programmer: Patrick Boenzli 13 13 co-programmer: ... 14 14 */ … … 23 23 24 24 #include "aabb.h" 25 #include "obb_tree.h" 25 26 26 27 #include <vector> … … 33 34 * standart constructor 34 35 */ 35 AimingSystem::AimingSystem ( const TiXmlElement* root)36 AimingSystem::AimingSystem (WorldEntity* entity) 36 37 { 37 38 this->init(); 38 39 40 if (root)41 this->loadParams(root);42 39 } 43 40 … … 59 56 60 57 this->loadModel("models/guns/targeting_system_body.obj"); 61 }62 58 63 64 void AimingSystem::loadParams(const TiXmlElement* root) 65 { 66 PNode::loadParams(root); 67 68 // LoadParam(root, "texture", this, AimingSystem, setTexture) 69 // .describe("the texture-file to load onto the AimingSystem"); 70 // 71 // LoadParam(root, "size", this, AimingSystem, setSize) 72 // .describe("the size of the AimingSystem in Pixels"); 73 // 74 // LoadParam(root, "rotation-speed", this, AimingSystem, setRotationSpeed) 75 // .describe("the Speed with which the AimingSystem should rotate"); 59 // registering default reactions: 60 this->subscribeReaction(CREngine::CR_OBJECT_DAMAGE, CL_WORLD_ENTITY); 76 61 } 77 62 … … 89 74 return this->selectionList.back(); 90 75 91 WorldEntity* nearestEntity = this->selectionList.back();76 WorldEntity* nearestEntity = NULL; 92 77 float distance = 0.0f; 93 78 float smalestDistance = this->range * 5.0f; … … 104 89 } 105 90 106 return nearestEntity; 91 if( nearestEntity != this->owner) 92 return nearestEntity; 93 else return NULL; 107 94 } 108 95 … … 127 114 { 128 115 129 this->selectionList.clear();116 // this->selectionList.clear(); 130 117 } 131 118 … … 136 123 void AimingSystem::draw() const 137 124 { 138 // if( this->getModelAABB() != NULL) 139 // this->getModelAABB()->drawBV(0, 1); 125 WorldEntity::draw(); 126 127 if( this->getOBBTree () != NULL) 128 this->getOBBTree()->drawBV(0, 1); 140 129 } -
branches/presentation/src/world_entities/weapons/aiming_system.h
r9166 r9168 22 22 23 23 public: 24 AimingSystem( const TiXmlElement* root= NULL);24 AimingSystem(WorldEntity* owner = NULL); 25 25 virtual ~AimingSystem(); 26 26 27 27 void init(); 28 virtual void loadParams(const TiXmlElement* root);29 30 31 inline void selectTarget(PNode* target) { this->setParent(target); };32 inline PNode* getTarget(PNode* target) { return this->getParent(); };33 28 34 29 WorldEntity* getNearestTarget(); 35 36 30 37 31 void setRange(float range){this->range = range;}; … … 47 41 std::vector<WorldEntity*> selectionList; //!< the selections 48 42 43 WorldEntity* owner; //!< the owner of the targeting system 49 44 50 45 };
Note: See TracChangeset
for help on using the changeset viewer.