Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Projectile.h

Go to the documentation of this file.
00001 
00007 #ifndef _PROJECTILE_H_
00008 #define _PROJECTILE_H_
00009 
00010 #include "../../Math/Vector.h"
00011 #include "../../Util/Log.h"
00012 
00013 class Projectile {
00014         public:
00015                 Projectile() {};
00016                 virtual ~Projectile() {};
00017 
00018                 inline void create(Vec3 p, Vec3 v, float s = 1.0f);
00019                 inline void update(float dTime);
00020 
00021                 Vec3 getPos() { return m_position; }
00022                 float getStrength() { return m_strength; }
00023                 bool isAlive() { return alive; }
00024                 void die() { alive = false; }
00025                 void setPlayerID(int id) { playerID = id; }
00026                 int getPlayerID() { return playerID; };
00027 
00028         private:
00029                 Vec3 m_position;
00030                 Vec3 m_prevPosition;
00031                 Vec3 m_velocity;
00032                 float m_strength;
00033                 bool alive;
00034                 int playerID;
00035 };
00036 
00037 /********************************************************************
00038  * Create
00039  */
00040 void Projectile::create(Vec3 p, Vec3 v, float s) {
00041         this->m_position = p;
00042         this->m_velocity = v;
00043         this->m_strength = s;
00044         alive = true;
00045 }
00046 
00047 /********************************************************************
00048  * Update
00049  */
00050 void Projectile::update(float dTime) {
00051         m_prevPosition = m_position;
00052         m_position += m_velocity*dTime;
00053 }
00054 
00055 #endif

Generated on Sun Jun 5 15:47:05 2005 for Defacto by  doxygen 1.4.3