[4779] | 1 | /*! |
---|
[5556] | 2 | * @file aim.h |
---|
| 3 | * Definition of |
---|
| 4 | */ |
---|
[3329] | 5 | |
---|
[5556] | 6 | #ifndef _AIM_H |
---|
| 7 | #define _AIM_H |
---|
[1853] | 8 | |
---|
[4849] | 9 | #include "p_node.h" |
---|
| 10 | #include "element_2d.h" |
---|
[6724] | 11 | #include "object_manager.h" |
---|
[5557] | 12 | |
---|
[9656] | 13 | #include "material.h" |
---|
| 14 | |
---|
[5405] | 15 | // FORWARD DECLARATION |
---|
[4830] | 16 | class Model; |
---|
[5750] | 17 | class Text; |
---|
[4832] | 18 | class TiXmlElement; |
---|
[5750] | 19 | template<class T> class tAnimation; |
---|
[3543] | 20 | |
---|
[9869] | 21 | |
---|
[5556] | 22 | //! An Aim for zooming in on Targets. |
---|
[5750] | 23 | /** |
---|
| 24 | * An Aim is a PNode, that is connected, to the Target, it has aquired |
---|
| 25 | * The target becomes, if selected its Parent. |
---|
| 26 | * |
---|
| 27 | * Also the Aim is a Element2D, as it draws a cross onto the Target. |
---|
| 28 | */ |
---|
[9656] | 29 | class Aim : public PNode, public Element2D |
---|
| 30 | { |
---|
[9869] | 31 | ObjectListDeclaration(Aim); |
---|
[2036] | 32 | |
---|
[9656] | 33 | public: |
---|
[5750] | 34 | Aim(PNode* source, const TiXmlElement* root = NULL); |
---|
[5556] | 35 | virtual ~Aim(); |
---|
[1853] | 36 | |
---|
[6512] | 37 | virtual void loadParams(const TiXmlElement* root); |
---|
[3245] | 38 | |
---|
[5750] | 39 | inline void setSource(PNode* source) { this->source = source; }; |
---|
| 40 | |
---|
[5557] | 41 | inline void selectTarget(PNode* target) { this->setParent(target); }; |
---|
[9656] | 42 | inline PNode* getTarget(PNode* target) const { return this->getParent(); }; |
---|
[5557] | 43 | |
---|
[6637] | 44 | void searchTarget(); |
---|
[5557] | 45 | |
---|
[9656] | 46 | void setRange(float range) {this->range = range;}; |
---|
| 47 | void setAngle(float angle) {this->angle = angle;}; |
---|
| 48 | void setTargetGroup(OM_LIST group) { this->targetGroup = group; }; |
---|
| 49 | void setTargetGroupS(const std::string& grounName); |
---|
[6637] | 50 | |
---|
[4832] | 51 | void setSize(float size); |
---|
[7221] | 52 | void setTexture(const std::string& textureFile); |
---|
[4832] | 53 | /** @param rotationSpeed the speed at what the crosshair should rotate */ |
---|
[5557] | 54 | inline void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; }; |
---|
[4832] | 55 | |
---|
[4849] | 56 | virtual void tick(float dt); |
---|
| 57 | virtual void draw() const; |
---|
[4779] | 58 | |
---|
[9656] | 59 | private: |
---|
| 60 | void init(); |
---|
[5750] | 61 | |
---|
[6637] | 62 | |
---|
[9656] | 63 | private: |
---|
| 64 | Material material; //!< a material for the Aim. |
---|
| 65 | float rotationSpeed; //!< Speed of the Rotation. |
---|
| 66 | tAnimation<Aim>* anim; |
---|
[5750] | 67 | |
---|
[9656] | 68 | float range; //!< |
---|
| 69 | float angle; //!< |
---|
| 70 | Vector diffVec; |
---|
| 71 | OM_LIST targetGroup; |
---|
| 72 | |
---|
| 73 | PNode* source; //!< Where this Shot has come from. |
---|
| 74 | |
---|
| 75 | // Text text; //!< A Text to display onto this Node. (distance to Target) |
---|
[1853] | 76 | }; |
---|
| 77 | |
---|
[5556] | 78 | #endif /* _AIM_H */ |
---|