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