Steeriously  0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
SeekComponent.hpp
1 #ifndef SeekComponent_HPP
2 #define SeekComponent_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 {
15  class SeekComponent : public steer::Agent
16  {
17  public:
19  virtual ~SeekComponent();
20 
26  void setWeight(const float weight) { m_weightSeek = weight; };
27 
32  float getWeight()const { return m_weightSeek; };
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 seekOn(){m_iFlags |= steer::behaviorType::seek;};
50 
51  bool isSeekOn(){return on(steer::behaviorType::seek);};
52  void seekOff(){if(on(steer::behaviorType::seek)) m_iFlags ^=steer::behaviorType::seek;}
53 
54  bool targetAcquired();
55 
56  //pure virtual - must implement see Agent.hpp
57  virtual Vector2 Calculate();
58 
59  void Update(float dt);
60 
61  private:
62  float m_weightSeek;
63  Uint32 m_iFlags;
64  float m_rotation;
65  };
66 }
67 
68 #endif // SeekComponent_HPP