Steeriously  0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
PathFollowingComponent.hpp
1 #ifndef PathFollowingComponent_HPP
2 #define PathFollowingComponent_HPP
3 
4 #include <steeriously/Agent.hpp>
5 #include <steeriously/BehaviorData.hpp>
6 #include <steeriously/BehaviorHelpers.hpp>
7 #include <steeriously/Path.hpp>
8 #include <steeriously/Vector2.hpp>
9 
10 namespace steer
11 {
17  {
18  public:
21  virtual ~PathFollowingComponent();
22 
28  void setWeight(const float weight) { m_weightPathFollowing = weight; };
29 
34  float getWeight()const { return m_weightPathFollowing; };
35 
40  void setRotation(float r) { m_rotation = r; };
41 
46  float getRotation() { return m_rotation; };
47 
48  void setPath(steer::Path* p){m_path = p;};
49  steer::Path* getPath() const {return m_path;};
50 
51  //pure virtual - must implement see Agent.hpp
52  virtual bool on(steer::behaviorType behavior){return (m_iFlags & behavior) == behavior;};
53 
54  void pathFollowingOn(){m_iFlags |= steer::behaviorType::followPath;};
55 
56  bool isPathFollowingOn(){return on(steer::behaviorType::followPath);};
57  void pathFollowingOff(){if(on(steer::behaviorType::followPath)) m_iFlags ^=steer::behaviorType::followPath;}
58 
59  bool targetAcquired();
60 
61  //pure virtual - must implement see Agent.hpp
62  virtual Vector2 Calculate();
63 
64  void Update(float dt);
65 
66  private:
67  float m_weightPathFollowing;
68  Uint32 m_iFlags;
69  float m_rotation;
70  steer::Path* m_path;
71  steer::BehaviorParameters* m_params;
72  };
73 }
74 
75 #endif // PathFollowingComponent_HPP