- Timestamp:
- Apr 1, 2005, 1:45:47 PM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/test_bullet.cc
r3708 r3709 17 17 18 18 19 #include " simple_bullet.h"19 #include "test_bullet.h" 20 20 21 21 #include "world_entity.h" … … 31 31 \brief standard constructor 32 32 */ 33 SimpleBullet::SimpleBullet (Weapon* weapon) : WorldEntity()33 TestBullet::TestBullet (Weapon* weapon) : WorldEntity() 34 34 {} 35 35 … … 38 38 \brief standard deconstructor 39 39 */ 40 SimpleBullet::~SimpleBullet ()40 TestBullet::~TestBullet () 41 41 { 42 42 /* … … 48 48 49 49 50 /**51 \brief this sets the flight direction of the projectile52 \param directin in which to flight53 54 this function will calculate a vector out of this to be used in the55 tick function56 */57 void SimpleBullet::setFlightDirection(Quaternion flightDirection)58 {59 if( this->flightDirection == NULL)60 this->flightDirection = new Vector();61 Vector v(1, 0, 0);62 *this->flightDirection = flightDirection.apply(v);63 this->flightDirection->normalize();64 }65 66 67 /**68 \brief this sets the time to life of the projectile69 \param ttl in second70 71 after this life time, the projectile will garbage collect itself72 */73 void SimpleBullet::setTTL(float ttl)74 {75 this->ttl = ttl;76 }77 78 79 /**80 \brief sets the speed of the projectile81 */82 void SimpleBullet::setSpeed(float speed)83 {84 this->speed = speed * 3; /* fix speed settings */85 PRINTF(4)("SimpleBullet::setting speed to: %f\n", this->speed);86 }87 50 88 51 /** … … 90 53 \param time since last tick 91 54 */ 92 void SimpleBullet::tick (float time)55 void TestBullet::tick (float time) 93 56 { 94 57 Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.7); … … 111 74 \param place where it is hit 112 75 */ 113 void SimpleBullet::hit (WorldEntity* entity, Vector* place)76 void TestBullet::hit (WorldEntity* entity, Vector* place) 114 77 {} 115 78 … … 118 81 \brief the function gets called, when the projectile is destroyed 119 82 */ 120 void SimpleBullet::destroy ()83 void TestBullet::destroy () 121 84 {} 122 85 123 86 124 void SimpleBullet::draw ()87 void TestBullet::draw () 125 88 { 126 89 glMatrixMode(GL_MODELVIEW); -
orxonox/trunk/src/world_entities/test_bullet.h
r3708 r3709 4 4 */ 5 5 6 #ifndef _ PROJECTILE_H7 #define _ PROJECTILE_H6 #ifndef _TEST_BULLET_H 7 #define _TEST_BULLET_H 8 8 9 9 #include "world_entity.h" … … 12 12 class Weapon; 13 13 14 class Projectile : public WorldEntity14 class TestBullet : public Projectile 15 15 { 16 16 friend class World; 17 17 18 18 public: 19 Projectile (Weapon* weapon); 20 virtual ~Projectile (); 21 22 void setFlightDirection(Quaternion flightDirection); 23 void setSpeed(float speed); 24 void setTTL(float ttl); 19 TestBullet (Weapon* weapon); 20 virtual ~TestBullet (); 25 21 26 22 virtual void hit (WorldEntity* weapon, Vector* loc); … … 29 25 virtual void tick (float time); 30 26 virtual void draw (); 31 32 private:33 //physical attriutes like: force, speed, acceleration etc.34 float speed; //!< this is the speed of the projectile35 float currentLifeTime; //!< this is the time, the projectile exists in this world (incremented by tick)36 float ttl; //!< time to life, after this time, the projectile will garbage collect itself37 Vector* flightDirection; //!< direction in which the shoot flights38 Weapon* weapon; //!< weapon the shoot belongs to39 27 40 28 }; 41 29 42 #endif /* _ PROJECTILE_H */30 #endif /* _TEST_BULLET_H */
Note: See TracChangeset
for help on using the changeset viewer.