Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/proxy/src/world_entities/weapons/aim.h @ 9607

Last change on this file since 9607 was 9516, checked in by bensch, 18 years ago

orxonox/proxy: the rockets from the targeting turrets aquire targets as they are supposed, but they do not get fired unless the player is near of them… strangely

File size: 2.0 KB
Line 
1/*!
2 * @file aim.h
3 *  Definition of
4 */
5
6#ifndef _AIM_H
7#define _AIM_H
8
9#include "p_node.h"
10#include "element_2d.h"
11#include "object_manager.h"
12
13#include "material.h"
14
15// FORWARD DECLARATION
16class Model;
17class Text;
18class TiXmlElement;
19template<class T> class tAnimation;
20
21//! An Aim for zooming in on Targets.
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 */
28class Aim : public PNode, public Element2D
29{
30
31public:
32  Aim(PNode* source, const TiXmlElement* root = NULL);
33  virtual ~Aim();
34
35  virtual void loadParams(const TiXmlElement* root);
36
37  inline void setSource(PNode* source) { this->source = source; };
38
39  inline void selectTarget(PNode* target) { this->setParent(target); };
40  inline PNode* getTarget(PNode* target) const { return this->getParent(); };
41
42  void searchTarget();
43
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);
48
49  void setSize(float size);
50  void setTexture(const std::string& textureFile);
51  /** @param rotationSpeed the speed at what the crosshair should rotate */
52  inline void setRotationSpeed(float rotationSpeed) { this->rotationSpeed = rotationSpeed; };
53
54  virtual void tick(float dt);
55  virtual void draw() const;
56
57private:
58  void init();
59
60
61private:
62  Material         material;             //!< a material for the Aim.
63  float            rotationSpeed;        //!< Speed of the Rotation.
64  tAnimation<Aim>* anim;
65
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)
74};
75
76#endif /* _AIM_H */
Note: See TracBrowser for help on using the repository browser.