AI_Obstacle.h
Go to the documentation of this file.00001 #ifndef AI_OBSTACLE_H
00002 #define AI_OBSTACLE_H
00003
00004 #include "AI_Agent.h"
00005
00006
00031 class AI_Obstacle : public AI_Agent
00032 {
00033
00034 public:
00035 enum OBSTACLE_TYPE {
00036 PASSABLE,
00037 NONPASSABLE,
00038 BARRIER
00039 };
00040
00042 typedef AI_Array<AI_Obstacle*> ObstacleArray;
00044 typedef ObstacleArray::iterator ObstacleArrayIt;
00045
00046
00047 public:
00049 float m_f_width;
00051 OBSTACLE_TYPE m_obstacle_type;
00053 bool m_b_active_obstacle;
00054
00055
00056 public:
00057 AI_Obstacle();
00058 AI_Obstacle(const TYPE type);
00059 ~AI_Obstacle();
00060
00061 virtual void setWidth( const float f_width );
00062 void setObstacleType( const OBSTACLE_TYPE info );
00063 void setActiveObstacle( const bool b );
00064
00065 const float getWidth( void ) const;
00066 const OBSTACLE_TYPE &getObstacleType( void ) const;
00067 const bool isObstacleActive(void) const;
00068 };
00069
00070
00073 inline
00074 AI_Obstacle::AI_Obstacle() :
00075 AI_Agent(OBSTACLE),
00076 m_f_width(0.5f),
00077 m_obstacle_type(PASSABLE),
00078 m_b_active_obstacle(true)
00079 {
00080 }
00081
00082
00085 inline
00086 AI_Obstacle::AI_Obstacle(const TYPE type) :
00087 AI_Agent(type),
00088 m_f_width(0.5f),
00089 m_obstacle_type(PASSABLE)
00090 {
00091 }
00092
00093
00096 inline
00097 AI_Obstacle::~AI_Obstacle()
00098 {
00099 }
00100
00101
00106 inline
00107 void AI_Obstacle::setWidth( const float f_width )
00108 {
00109 m_f_width = ai_max(0, f_width);
00110
00111 float f_double = 2.0f * m_f_width;
00112 setAura( AI_Vector3(f_double, f_double, f_double) );
00113 }
00114
00115
00118 inline
00119 const float AI_Obstacle::getWidth( void ) const
00120 {
00121 return m_f_width;
00122 }
00123
00124
00129 inline
00130 void AI_Obstacle::setObstacleType( const OBSTACLE_TYPE obstacle_type )
00131 {
00132 m_obstacle_type = obstacle_type;
00133 }
00134
00135
00140 inline
00141 const AI_Obstacle::OBSTACLE_TYPE &AI_Obstacle::getObstacleType( void ) const
00142 {
00143 return m_obstacle_type;
00144 }
00145
00146
00151 inline
00152 void AI_Obstacle::setActiveObstacle( const bool b )
00153 {
00154 m_b_active_obstacle = b;
00155 }
00156
00157
00160 inline
00161 const bool AI_Obstacle::isObstacleActive(void) const
00162 {
00163 return m_b_active_obstacle;
00164 }
00165
00166
00167 #endif