- Timestamp:
- Mar 16, 2005, 4:24:09 PM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/weapon.cc
r3573 r3575 22 22 #include "vector.h" 23 23 #include "objModel.h" 24 #include "projectile.h" 24 25 25 26 using namespace std; 26 27 27 28 29 /** 30 \brief standard constructor 28 31 32 creates a new weapon 33 */ 29 34 Weapon::Weapon () : WorldEntity() 30 35 { 31 this->model = new OBJModel(" ../data/models/fighter.obj");36 this->model = new OBJModel(""); 32 37 } 33 38 34 39 35 40 /** 41 \brief standard deconstructor 42 */ 36 43 Weapon::~Weapon () 37 44 { … … 39 46 } 40 47 41 void Weapon::tick (float time) {}42 48 43 void Weapon::hit (WorldEntity* weapon, Vector loc) {} 49 /** 50 \brief sets a new projectile to the weapon 51 \param new projectile for this weapon 44 52 45 void Weapon::destroy () {} 53 weapon an projectile are independent, so you can combine them as you want 54 */ 55 void Weapon::setProjectile(Projectile* projectile) 56 { 57 this->projectile = projectile; 58 } 46 59 47 void Weapon::collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) {}48 60 61 /** 62 \brief sets a new projectile to the weapon 63 \returns the current projectile of this weapon 64 65 weapon an projectile are independent, so you can combine them as you want 66 */ 67 Projectile* Weapon::getProjectile() 68 { 69 return this->projectile; 70 } 71 72 73 /** 74 \brief this activates the weapon 75 76 This is needed, since there can be more than one weapon on a ship. the 77 activation can be connected with an animation. for example the weapon is 78 been armed out. 79 */ 80 void Weapon::activate() 81 {} 82 83 84 /** 85 \brief this deactivates the weapon 86 87 This is needed, since there can be more than one weapon on a ship. the 88 activation can be connected with an animation. for example the weapon is 89 been armed out. 90 */ 91 void Weapon::deactivate() 92 {} 93 94 /** 95 \brief asks if the current weapon is active 96 \returns true if it the weapon is active 97 */ 98 bool Weapon::isActive() 99 {} 100 101 102 103 104 105 /** 106 \brief tick signal for time dependent/driven stuff 107 */ 108 void Weapon::tick (float time) 109 {} 110 111 /** 112 \brief is called, when the weapon gets hit (=collide with something) 113 \param from which entity it is been hit 114 \param where it is been hit 115 116 this may not be used, since it would make the game relay complicated when one 117 can destroy the weapons of enemies or vice versa. 118 */ 119 void Weapon::hit (WorldEntity* entity, Vector position) 120 {} 121 122 /** 123 \brief is called, when the weapon is destroyed 124 125 this is in conjunction with the hit function, so when a weapon is able to get 126 hit, it can also be destoryed. 127 */ 128 void Weapon::destroy () 129 {} 130 131 132 /** 133 \brief this will draw the weapon 134 */ 49 135 void Weapon::draw () 50 136 { 51 137 glMatrixMode(GL_MODELVIEW); 52 138 glPushMatrix(); 139 53 140 float matrix[4][4]; 54 55 141 glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); 56 //rotate57 142 this->getAbsDir().matrix (matrix); 58 143 glMultMatrixf((float*)matrix); 59 60 144 this->model->draw(); 61 145 -
orxonox/trunk/src/world_entities/weapon.h
r3573 r3575 16 16 weapon in this world: 17 17 o sound file/ressource: this is a pointer to the sound-file/ressource. however it may be represented 18 o shooting animation 18 19 19 20 */ … … 25 26 #include "world_entity.h" 26 27 28 class Projectile; 27 29 28 30 class Weapon : public WorldEntity … … 34 36 virtual ~Weapon (); 35 37 36 virtual void tick (float time); 38 void setProjectile(Projectile* projectile); 39 Projectile* getProjectile(); 40 41 void activate(); 42 void deactivate(); 43 bool isActive(); 44 45 void setWeaponEnergy(int energy); 46 void addWeaponEnergy(int addEnergy); 47 void substractWeaponEnergy(int subEnergy); 48 int getWeaponEnergy(); 49 50 void fire(); 37 51 virtual void hit (WorldEntity* weapon, Vector loc); 38 52 virtual void destroy (); 39 virtual void collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags); 53 54 virtual void tick (float time); 40 55 virtual void draw (); 56 41 57 42 58 private: 43 59 float firingRate; 60 float localTime; 44 61 float slowDownFactor; 45 62 int energyConsumption; 63 Projectile* projectile; 46 64 47 65 };
Note: See TracChangeset
for help on using the changeset viewer.