Steeriously  0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
ArriveComponent.hpp
1 #ifndef ArriveComponent_HPP
2 #define ArriveComponent_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 {
17  {
18  public:
20  virtual ~ArriveComponent();
21 
27  void setWeight(const float weight) { m_weightArrive = weight; };
28 
33  float getWeight()const { return m_weightArrive; };
34 
39  void setRotation(float r) { m_rotation = r; };
40 
45  float getRotation() { return m_rotation; };
46 
47  //pure virtual - must implement see Agent.hpp
48  virtual bool on(steer::behaviorType behavior){return (m_iFlags & behavior) == behavior;};
49 
50  void arriveOn(){m_iFlags |= steer::behaviorType::arrive;};
51 
52  bool isArriveOn(){return on(steer::behaviorType::arrive);};
53  void arriveOff(){if(on(steer::behaviorType::arrive)) m_iFlags ^=steer::behaviorType::arrive;}
54 
55  bool targetAcquired();
56 
57  //pure virtual - must implement see Agent.hpp
58  virtual Vector2 Calculate();
59 
60  void Update(float dt);
61 
62  private:
63  float m_weightArrive;
64  Uint32 m_iFlags;
65  float m_rotation;
66  };
67 }
68 
69 #endif // ArriveComponent_HPP