Steeriously  0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
OffsetPursuitComponent.hpp
1 #ifndef OffsetPursuitComponent_HPP
2 #define OffsetPursuitComponent_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 ~OffsetPursuitComponent();
20 
26  void setWeight(const float weight) { m_weightOffsetPursuit = weight; };
27 
32  float getWeight()const { return m_weightOffsetPursuit; };
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 OffsetPursuitOn(){m_iFlags |= steer::behaviorType::offsetPursuit;};
50 
51  bool isOffsetPursuitOn(){return on(steer::behaviorType::offsetPursuit);};
52  void offsetPursuitOff(){if(on(steer::behaviorType::offsetPursuit)) m_iFlags ^=steer::behaviorType::offsetPursuit;}
53 
54  void setLeader(steer::Agent* l){m_leader = l;};
55 
56  steer::Agent* getLeader() const {return m_leader;};
57 
58  //pure virtual - must implement see Agent.hpp
59  virtual Vector2 Calculate();
60 
61  void Update(float dt);
62 
63  private:
64  float m_weightOffsetPursuit;
65  Uint32 m_iFlags;
66  float m_rotation;
67  steer::Agent* m_leader;
68  steer::BehaviorParameters* m_params;
69  };
70 }
71 
72 #endif // OffsetPursuitComponent_HPP