Steeriously  0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
WanderComponent.hpp
1 #ifndef WANDERCOMPONENT_HPP
2 #define WANDERCOMPONENT_HPP
3 
4 #include <steeriously/Agent.hpp>
5 #include <steeriously/BehaviorData.hpp>
6 #include <steeriously/BehaviorHelpers.hpp>
7 
8 namespace steer
9 {
15  {
16  public:
18  virtual ~WanderComponent();
19 
20  void Update(float dt);
21 
27  void setWeight(const float weight) { m_weightWander = weight; };
28 
33  float getWeight()const { return m_weightWander; };
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 wanderOn() { m_iFlags |= steer::behaviorType::wander; };
51  void wanderOff() { if (on(steer::behaviorType::wander)) m_iFlags ^= steer::behaviorType::wander; };
52  bool isWanderOn() { return on(steer::behaviorType::wander); };
53 
54  //pure virtual - must implement see Agent.hpp
55  virtual Vector2 Calculate();
56 
57  private:
58  float m_weightWander;
59  Uint32 m_iFlags;
60  float m_rotation;
61  };
62 }
63 
64 #endif //WANDERCOMPONENT_HPP