00001 #ifndef USERAGENT_H 00002 #define USERAGENT_H 00003 00004 #include "Agent.h" 00005 #include "UserControls.h" 00006 00015 00016 00017 //The variable to set the number of bullets per each game entity 00018 const static float BULLETS=1.0; 00019 00020 class Agent; 00021 class Ammo; 00022 00023 00024 class UserAgent 00025 { 00026 public: 00027 //---------------------------------------------------------------------------------------------------------------------- 00036 //---------------------------------------------------------------------------------------------------------------------- 00037 UserAgent(Agent* _agent,int _index, Models *_model,Graph *_graph,std::string _meshName, std::string _name); 00038 //---------------------------------------------------------------------------------------------------------------------- 00040 //---------------------------------------------------------------------------------------------------------------------- 00041 ~UserAgent(); 00042 //---------------------------------------------------------------------------------------------------------------------- 00044 //---------------------------------------------------------------------------------------------------------------------- 00045 void update(); 00046 //---------------------------------------------------------------------------------------------------------------------- 00050 //---------------------------------------------------------------------------------------------------------------------- 00051 void draw( 00052 ngl::TransformStack *_tx, 00053 ngl::Camera *_cam 00054 ); 00055 //---------------------------------------------------------------------------------------------------------------------- 00057 //---------------------------------------------------------------------------------------------------------------------- 00058 ngl::Vec3 inline getPos(){return m_pos;} 00059 //---------------------------------------------------------------------------------------------------------------------- 00061 //---------------------------------------------------------------------------------------------------------------------- 00062 ngl::Vec3 inline getVelocity(){return m_velocity;} 00063 //---------------------------------------------------------------------------------------------------------------------- 00066 //---------------------------------------------------------------------------------------------------------------------- 00067 void inline setPosition(ngl::Vec3 pos){m_pos = pos;} 00068 //---------------------------------------------------------------------------------------------------------------------- 00071 //---------------------------------------------------------------------------------------------------------------------- 00072 void inline setVelocity(ngl::Vec3 _vel){m_velocity = _vel;} 00073 //---------------------------------------------------------------------------------------------------------------------- 00075 //---------------------------------------------------------------------------------------------------------------------- 00076 void reset(); 00077 //---------------------------------------------------------------------------------------------------------------------- 00079 //---------------------------------------------------------------------------------------------------------------------- 00080 std::string inline getName(){return m_name;} 00081 //---------------------------------------------------------------------------------------------------------------------- 00083 //---------------------------------------------------------------------------------------------------------------------- 00084 int inline getNextIndex(){return m_nextIndex;} 00085 //---------------------------------------------------------------------------------------------------------------------- 00087 //---------------------------------------------------------------------------------------------------------------------- 00088 int inline getIndex(){return m_index;} 00089 //---------------------------------------------------------------------------------------------------------------------- 00091 //---------------------------------------------------------------------------------------------------------------------- 00092 void inline setIndex(const int _index){m_index = _index;} 00093 //---------------------------------------------------------------------------------------------------------------------- 00095 //---------------------------------------------------------------------------------------------------------------------- 00096 void inline setNextIndex(const int _nextIndex){m_nextIndex = _nextIndex;} 00097 //---------------------------------------------------------------------------------------------------------------------- 00099 //---------------------------------------------------------------------------------------------------------------------- 00100 int inline getPrecision(){return m_precision;} 00101 //---------------------------------------------------------------------------------------------------------------------- 00103 //---------------------------------------------------------------------------------------------------------------------- 00104 UserControls* getUserControl(){return m_userControl;} 00105 //---------------------------------------------------------------------------------------------------------------------- 00107 //---------------------------------------------------------------------------------------------------------------------- 00108 void inline setScore(const int _score){m_score += _score;} 00109 //---------------------------------------------------------------------------------------------------------------------- 00111 //---------------------------------------------------------------------------------------------------------------------- 00112 int getScore(){return m_score;} 00113 //---------------------------------------------------------------------------------------------------------------------- 00115 //---------------------------------------------------------------------------------------------------------------------- 00116 void inline setNoOfBullets(const int _num){m_noOfBullets += _num*BULLETS;} 00117 //---------------------------------------------------------------------------------------------------------------------- 00119 //---------------------------------------------------------------------------------------------------------------------- 00120 int getnoOfBullets(){return m_noOfBullets;} 00121 //---------------------------------------------------------------------------------------------------------------------- 00123 //---------------------------------------------------------------------------------------------------------------------- 00124 void shoot(); 00125 //---------------------------------------------------------------------------------------------------------------------- 00127 //---------------------------------------------------------------------------------------------------------------------- 00128 bool m_keyPressed; 00129 private: 00130 //---------------------------------------------------------------------------------------------------------------------- 00132 //---------------------------------------------------------------------------------------------------------------------- 00133 ngl::Vec3 m_pos; 00134 //---------------------------------------------------------------------------------------------------------------------- 00136 //---------------------------------------------------------------------------------------------------------------------- 00137 ngl::Vec3 m_dir; 00138 //---------------------------------------------------------------------------------------------------------------------- 00140 //---------------------------------------------------------------------------------------------------------------------- 00141 ngl::Vec3 m_velocity; 00142 //---------------------------------------------------------------------------------------------------------------------- 00144 //---------------------------------------------------------------------------------------------------------------------- 00145 int m_index; 00146 //---------------------------------------------------------------------------------------------------------------------- 00148 //---------------------------------------------------------------------------------------------------------------------- 00149 int m_nextIndex; 00150 //---------------------------------------------------------------------------------------------------------------------- 00152 //---------------------------------------------------------------------------------------------------------------------- 00153 std::string m_meshName; 00154 //---------------------------------------------------------------------------------------------------------------------- 00156 //---------------------------------------------------------------------------------------------------------------------- 00157 ngl::Vec3 m_nextPos; 00158 //---------------------------------------------------------------------------------------------------------------------- 00160 //---------------------------------------------------------------------------------------------------------------------- 00161 Agent* m_parent; 00162 //---------------------------------------------------------------------------------------------------------------------- 00164 //---------------------------------------------------------------------------------------------------------------------- 00165 Models* m_model; 00166 //---------------------------------------------------------------------------------------------------------------------- 00168 //---------------------------------------------------------------------------------------------------------------------- 00169 Graph* m_graph; 00170 //---------------------------------------------------------------------------------------------------------------------- 00172 //---------------------------------------------------------------------------------------------------------------------- 00173 int m_precision; 00174 //---------------------------------------------------------------------------------------------------------------------- 00176 //---------------------------------------------------------------------------------------------------------------------- 00177 ngl::Vec3 m_resetPos; 00178 //---------------------------------------------------------------------------------------------------------------------- 00180 //---------------------------------------------------------------------------------------------------------------------- 00181 ngl::Vec3 m_resetVel; 00182 //---------------------------------------------------------------------------------------------------------------------- 00184 //---------------------------------------------------------------------------------------------------------------------- 00185 UserControls* m_userControl; 00186 //---------------------------------------------------------------------------------------------------------------------- 00188 //---------------------------------------------------------------------------------------------------------------------- 00189 int m_score; 00190 //---------------------------------------------------------------------------------------------------------------------- 00192 //---------------------------------------------------------------------------------------------------------------------- 00193 int m_noOfBullets; 00194 //---------------------------------------------------------------------------------------------------------------------- 00196 //---------------------------------------------------------------------------------------------------------------------- 00197 std::list<Ammo *> m_ammo; 00198 //---------------------------------------------------------------------------------------------------------------------- 00200 //---------------------------------------------------------------------------------------------------------------------- 00201 std::string m_name; 00202 00203 }; 00204 00205 #endif // USERAGENT_H