Changeset 645 for code/branches/FICN/src/orxonox/objects/weapon_system
- Timestamp:
- Dec 19, 2007, 3:05:56 AM (17 years ago)
- Location:
- code/branches/FICN/src/orxonox/objects/weapon_system
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/objects/weapon_system/barrel_gun.cc
r637 r645 52 52 primaryFirePower_ = 100; 53 53 secondaryFirePower_ = 500; 54 primaryFiringRate_ = 1 0;55 secondaryFiringRate_ = 2;56 primaryBulletSpeed_ = 1000;57 secondaryBulletSpeed_ = 500;54 primaryFiringRate_ = 1.0/7.0; 55 secondaryFiringRate_ = 1.0/2.0; 56 primaryBulletSpeed_ = 800; 57 secondaryBulletSpeed_ = 300; 58 58 magazineSize_ = 25; 59 59 } … … 80 80 + StringConverter::toString(bulletCounter_++), "Barrel.mesh"); 81 81 82 Vector3 speed = (temp->getOrientation() * Vector3( 0, 0, -1))82 Vector3 speed = (temp->getOrientation() * Vector3(1, 0, 0)) 83 83 .normalisedCopy() * primaryBulletSpeed_; 84 84 speed += getVelocity(); 85 85 86 temp->setScale(Vector3(1, 1, 1) * 4);86 temp->setScale(Vector3(1, 1, 1) * 2); 87 87 temp->yaw(Degree(-90)); 88 88 … … 97 97 98 98 99 void BarrelGun::primaryFiring( unsigned int time)99 void BarrelGun::primaryFiring(float time) 100 100 { 101 if (time > (unsigned int)1000/primaryFiringRate_)101 if (time > primaryFiringRate_) 102 102 { 103 103 currentState_ = IDLE; … … 122 122 + StringConverter::toString(bulletCounter_++), "Barrel.mesh"); 123 123 124 Vector3 speed = (temp->getOrientation() * Vector3( 0, 0, -1))124 Vector3 speed = (temp->getOrientation() * Vector3(1, 0, 0)) 125 125 .normalisedCopy() * secondaryBulletSpeed_*0.5; 126 126 speed += getVelocity(); 127 127 128 temp->setScale(Vector3(1, 1, 1) * 10);128 temp->setScale(Vector3(1, 1, 1) * 4); 129 129 temp->yaw(Degree(-90)); 130 130 … … 140 140 141 141 142 void BarrelGun::secondaryFiring( unsigned int time)142 void BarrelGun::secondaryFiring(float time) 143 143 { 144 if (time > (unsigned int)1000/secondaryFiringRate_)144 if (time > secondaryFiringRate_) 145 145 currentState_ = IDLE; 146 146 } -
code/branches/FICN/src/orxonox/objects/weapon_system/barrel_gun.h
r637 r645 49 49 void primaryFire(); 50 50 51 void primaryFiring( unsigned int);51 void primaryFiring(float); 52 52 53 53 void secondaryFire(); 54 54 55 void secondaryFiring( unsigned int);55 void secondaryFiring(float); 56 56 57 57 public: -
code/branches/FICN/src/orxonox/objects/weapon_system/base_weapon.cc
r637 r645 46 46 47 47 CreateFactory(BaseWeapon); 48 49 float BaseWeapon::nextActionValidityPeriod_ = 0.5; 48 50 49 51 BaseWeapon::BaseWeapon() … … 105 107 { 106 108 case PRIMARY_FIRE: 107 primaryFiring( (unsigned int)(totalTime_ - actionStartTime_));109 primaryFiring(totalTime_ - actionStartTime_); 108 110 break; 109 111 110 112 case SECONDARY_FIRE: 111 secondaryFiring( (unsigned int)(totalTime_ - actionStartTime_));113 secondaryFiring(totalTime_ - actionStartTime_); 112 114 break; 113 115 -
code/branches/FICN/src/orxonox/objects/weapon_system/base_weapon.h
r637 r645 78 78 virtual void primaryFire() { }; 79 79 80 virtual void primaryFiring( unsigned int) { };80 virtual void primaryFiring(float) { }; 81 81 82 82 virtual void secondaryFire() { }; 83 83 84 virtual void secondaryFiring( unsigned int) { };84 virtual void secondaryFiring(float) { }; 85 85 86 86 inline void registerAllVariables() { }//Model::registerAllVariables(); } … … 100 100 101 101 float totalTime_; 102 unsigned longactionStartTime_;102 float actionStartTime_; 103 103 104 104 State currentState_; … … 107 107 Action nextAction_; 108 108 bool actionAdded_; 109 unsigned longtimeSinceNextActionAdded_;110 static const unsigned long nextActionValidityPeriod_ = 500;109 float timeSinceNextActionAdded_; 110 static float nextActionValidityPeriod_; 111 111 112 112 // weapon properties 113 113 int leftAmmo_; 114 int primaryFirePower_;115 int secondaryFirePower_;116 int primaryFiringRate_;117 int secondaryFiringRate_;114 float primaryFirePower_; 115 float secondaryFirePower_; 116 float primaryFiringRate_; 117 float secondaryFiringRate_; 118 118 Ogre::Real primaryBulletSpeed_; 119 119 Ogre::Real secondaryBulletSpeed_;
Note: See TracChangeset
for help on using the changeset viewer.