1 #ifndef SuperComponent_HPP
2 #define SuperComponent_HPP
4 #include <steeriously/libinc.hpp>
21 void Update(
float dt);
29 void setNeighbors(std::vector<SuperComponent*>* n) { m_neighbors = n; };
30 std::vector<SuperComponent*>* getNeighbors() {
return m_neighbors; };
32 void setObstacles(std::vector<SphereObstacle*>* o) { m_obstacles = o; };
33 std::vector<SphereObstacle*>* getObstacles() {
return m_obstacles; };
35 void setWalls(std::vector<Wall*>* w) { m_walls = w; };
36 std::vector<Wall*>* getWalls() {
return m_walls; };
44 void alignmentOn() { m_iFlags |= steer::behaviorType::alignment; };
45 void separationOn() { m_iFlags |= steer::behaviorType::separation; };
46 void cohesionOn() { m_iFlags |= steer::behaviorType::cohesion; };
47 void seekOn() { m_iFlags |= steer::behaviorType::seek; };
48 void wanderOn() { m_iFlags |= steer::behaviorType::wander; };
49 void wallAvoidanceOn() { m_iFlags |= steer::behaviorType::wallAvoidance; };
50 void obstacleAvoidanceOn() { m_iFlags |= steer::behaviorType::obstacleAvoidance; };
51 void pursuitOn(){m_iFlags |= steer::behaviorType::pursuit;};
52 void offsetPursuitOn(){m_iFlags |= steer::behaviorType::offsetPursuit;};
53 void interposeOn(){m_iFlags |= steer::behaviorType::interpose;};
54 void hideOn(){m_iFlags |= steer::behaviorType::hide;};
55 void pathFollowingOn(){m_iFlags |= steer::behaviorType::followPath;};
56 void fleeOn(){m_iFlags |= steer::behaviorType::flee;};
57 void evadeOn(){m_iFlags |= steer::behaviorType::evade;};
58 void arriveOn(){m_iFlags |= steer::behaviorType::arrive;};
60 void cohesionOff() {
if (
on(steer::behaviorType::cohesion)) m_iFlags ^= steer::behaviorType::cohesion; };
61 void separationOff() {
if (
on(steer::behaviorType::separation)) m_iFlags ^= steer::behaviorType::separation; };
62 void alignmentOff() {
if (
on(steer::behaviorType::alignment)) m_iFlags ^= steer::behaviorType::alignment; };
63 void seekOff() {
if (
on(steer::behaviorType::seek)) m_iFlags ^= steer::behaviorType::seek; };
64 void wanderOff() {
if (
on(steer::behaviorType::wander)) m_iFlags ^= steer::behaviorType::wander; };
65 void wallAvoidanceOff() {
if (
on(steer::behaviorType::wallAvoidance)) m_iFlags ^= steer::behaviorType::wallAvoidance; };
66 void obstacleAvoidanceOff() {
if (
on(steer::behaviorType::obstacleAvoidance)) m_iFlags ^= steer::behaviorType::obstacleAvoidance; };
67 void pursuitOff(){
if(
on(steer::behaviorType::pursuit)) m_iFlags ^=steer::behaviorType::pursuit;};
68 void offsetPursuitOff(){
if(
on(steer::behaviorType::offsetPursuit)) m_iFlags ^=steer::behaviorType::offsetPursuit;}
69 void interposeOff(){
if(
on(steer::behaviorType::interpose)) m_iFlags ^=steer::behaviorType::interpose;}
70 void hideOff(){
if(
on(steer::behaviorType::hide)) m_iFlags ^=steer::behaviorType::hide;}
71 void pathFollowingOff(){
if(
on(steer::behaviorType::followPath)) m_iFlags ^=steer::behaviorType::followPath;}
72 void fleeOff(){
if(
on(steer::behaviorType::flee)) m_iFlags ^=steer::behaviorType::flee;}
73 void evadeOff(){
if(
on(steer::behaviorType::evade)) m_iFlags ^=steer::behaviorType::evade;}
74 void arriveOff(){
if(
on(steer::behaviorType::arrive)) m_iFlags ^=steer::behaviorType::arrive;}
76 bool isCohesionOn() {
return on(steer::behaviorType::cohesion); };
77 bool isSeparationOn() {
return on(steer::behaviorType::separation); };
78 bool isAlignmentOn() {
return on(steer::behaviorType::alignment); };
79 bool isSeekOn() {
return on(steer::behaviorType::seek); };
80 bool isWanderOn() {
return on(steer::behaviorType::wander); };
81 bool isWallAvoidanceOn() {
return on(steer::behaviorType::wallAvoidance); };
82 bool isObstacleAvoidanceOn() {
return on(steer::behaviorType::obstacleAvoidance); };
83 bool isFlockingOn() {
return isCohesionOn() && isAlignmentOn() && isSeparationOn() && isSeekOn() && isWanderOn() && isWallAvoidanceOn() && isObstacleAvoidanceOn(); };
84 bool isPursuitOn(){
return on(steer::behaviorType::pursuit);};
85 bool isOffsetPursuitOn(){
return on(steer::behaviorType::offsetPursuit);};
86 bool isInterposeOn(){
return on(steer::behaviorType::interpose);};
87 bool isHideOn(){
return on(steer::behaviorType::hide);};
88 bool isPathFollowingOn(){
return on(steer::behaviorType::followPath);};
89 bool isFleeOn(){
return on(steer::behaviorType::flee);};
90 bool isEvadeOn(){
return on(steer::behaviorType::evade);};
91 bool isArriveOn(){
return on(steer::behaviorType::arrive);};
101 obstacleAvoidanceOn();
112 obstacleAvoidanceOff();
115 bool targetAcquired();
118 steer::Agent* getEvadeAgent()
const {
return m_evadeAgent;};
120 void setPursuitAgent(
steer::Agent* a){m_pursuitAgent = a;};
121 steer::Agent* getPursuitAgent()
const {
return m_pursuitAgent;};
127 void setInterposeAgentA(
steer::Agent* a){m_interposeAgentA = a;};
128 void setInterposeAgentB(
steer::Agent* b){m_interposeAgentB = b;};
130 steer::Agent* getInterposeAgentA()
const {
return m_interposeAgentA;};
131 steer::Agent* getInterposeAgentB()
const {
return m_interposeAgentB;};
134 steer::Agent* getHideAgent()
const {
return m_hideAgent;};
140 virtual Vector2 calculateWeightedSum()
override;
167 std::vector<SuperComponent*>* m_neighbors;
168 std::vector<SphereObstacle*>* m_obstacles;
169 std::vector<Wall*>* m_walls;
175 #endif // SuperComponent_HPP