Steeriously  0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
EvadeComponent.hpp
1 #ifndef EvadeComponent_HPP
2 #define EvadeComponent_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 ~EvadeComponent();
21 
27  void setWeight(const float weight) { m_weightEvade = weight; };
28 
33  float getWeight()const { return m_weightEvade; };
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 evadeOn(){m_iFlags |= steer::behaviorType::evade;};
51 
52  bool isEvadeOn(){return on(steer::behaviorType::evade);};
53  void evadeOff(){if(on(steer::behaviorType::evade)) m_iFlags ^=steer::behaviorType::evade;}
54 
55  void setTargetAgent(steer::Agent* a){m_targetAgent = a;};
56  steer::Agent* getTargetAgent() const {return m_targetAgent;};
57 
58  //pure virtual - must implement see Agent.hpp
59  virtual Vector2 Calculate();
60 
61  void Update(float dt);
62 
63  private:
64  float m_weightEvade;
65  Uint32 m_iFlags;
66  float m_rotation;
67  steer::Agent* m_targetAgent;
68  };
69 }
70 
71 #endif // EvadeComponent_HPP