/*! * @file aim.h * Definition of */ #ifndef _AIM_H #define _AIM_H #include "p_node.h" #include "element_2d.h" #include "object_manager.h" #include "material.h" // FORWARD DECLARATION class Model; class Text; class TiXmlElement; template class tAnimation; //! An Aim for zooming in on Targets. /** * An Aim is a PNode, that is connected, to the Target, it has aquired * The target becomes, if selected its Parent. * * Also the Aim is a Element2D, as it draws a cross onto the Target. */ class Aim : public PNode, public Element2D { public: Aim(PNode* source, const TiXmlElement* root = NULL); virtual ~Aim(); virtual void loadParams(const TiXmlElement* root); inline void setSource(PNode* source) { this->source = source; }; inline void selectTarget(PNode* target) { this->setParent(target); }; inline PNode* getTarget(PNode* target) const { return this->getParent(); }; void searchTarget(); void setRange(float range) {this->range = range;}; void setAngle(float angle) {this->angle = angle;}; void setTargetGroup(OM_LIST group) { this->targetGroup = group; }; void setTargetGroupS(const std::string& grounName); void setSize(float size); void setTexture(const std::string& textureFile); /** @param rotationSpeed the speed at what the crosshair should rotate */ inline void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; }; virtual void tick(float dt); virtual void draw() const; private: void init(); private: Material material; //!< a material for the Aim. float rotationSpeed; //!< Speed of the Rotation. tAnimation* anim; float range; //!< float angle; //!< Vector diffVec; OM_LIST targetGroup; PNode* source; //!< Where this Shot has come from. // Text text; //!< A Text to display onto this Node. (distance to Target) }; #endif /* _AIM_H */