Steeriously  0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
PursuitComponent.hpp
1 #ifndef PursuitComponent_HPP
2 #define PursuitComponent_HPP
3 
4 #include <steeriously/Agent.hpp>
5 #include <steeriously/BehaviorData.hpp>
6 #include <steeriously/BehaviorHelpers.hpp>
7 #include <steeriously/Vector2.hpp>
8 
9 namespace steer
10 {
16  {
17  public:
19  virtual ~PursuitComponent();
20 
26  void setWeight(const float weight) { m_weightPursuit = weight; };
27 
32  float getWeight()const { return m_weightPursuit; };
33 
38  void setRotation(float r) { m_rotation = r; };
39 
44  float getRotation() { return m_rotation; };
45 
46  //pure virtual - must implement see Agent.hpp
47  virtual bool on(steer::behaviorType behavior){return (m_iFlags & behavior) == behavior;};
48 
49  void pursuitOn(){m_iFlags |= steer::behaviorType::pursuit;};
50 
51  bool isPursuitOn(){return on(steer::behaviorType::pursuit);};
52  void pursuitOff(){if(on(steer::behaviorType::pursuit)) m_iFlags ^=steer::behaviorType::pursuit;};
53 
54  void setTargetAgent(steer::Agent* a){m_targetAgent = a;};
55  steer::Agent* getTargetAgent() const {return m_targetAgent;};
56 
57  bool targetAcquired();
58 
59  //pure virtual - must implement see Agent.hpp
60  virtual Vector2 Calculate();
61 
62  void Update(float dt);
63 
64  private:
65  float m_weightPursuit;
66  Uint32 m_iFlags;
67  float m_rotation;
68  steer::Agent* m_targetAgent;
69  };
70 }
71 
72 #endif // PursuitComponent_HPP