Steeriously  0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
HideComponent.hpp
1 #ifndef HideComponent_HPP
2 #define HideComponent_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 HideComponent : public steer::Agent
16  {
17  public:
19  virtual ~HideComponent();
20 
21  void setParams(steer::BehaviorParameters* params) { m_params = params; };
22  steer::BehaviorParameters* getParams() { return m_params; };
23 
29  void setWeight(const float weight) { m_weightHide = weight; };
30 
35  float getWeight()const { return m_weightHide; };
36 
41  void setRotation(float r) { m_rotation = r; };
42 
48  float getRotation() { return m_rotation; };
49 
50  void setObstacles(std::vector<SphereObstacle*>* o) { m_obstacles = o; };
51  std::vector<SphereObstacle*>* getObstacles() { return m_obstacles; };
52 
53  //pure virtual - must implement see Agent.hpp
54  virtual bool on(steer::behaviorType behavior){return (m_iFlags & behavior) == behavior;};
55 
56  void HideOn(){m_iFlags |= steer::behaviorType::hide;};
57 
58  bool isHideOn(){return on(steer::behaviorType::hide);};
59  void HideOff(){if(on(steer::behaviorType::hide)) m_iFlags ^=steer::behaviorType::hide;}
60 
61  void setTargetAgent(steer::Agent* a){m_targetAgent = a;};
62  steer::Agent* getTargetAgent() const {return m_targetAgent;};
63 
64  //pure virtual - must implement see Agent.hpp
65  virtual Vector2 Calculate();
66 
67  void Update(float dt);
68 
69  private:
70  float m_weightHide;
71  Uint32 m_iFlags;
72  float m_rotation;
73  steer::Agent* m_targetAgent;
74  std::vector<SphereObstacle*>* m_obstacles;
75  steer::BehaviorParameters* m_params;
76  };
77 }
78 
79 #endif // SeekComponent_HPP