Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 19, 2007, 3:05:56 AM (17 years ago)
Author:
rgrieder
Message:
  • weapon system up and running
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  
    5252    primaryFirePower_ = 100;
    5353    secondaryFirePower_ = 500;
    54     primaryFiringRate_ = 10;
    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;
    5858    magazineSize_ = 25;
    5959  }
     
    8080          + StringConverter::toString(bulletCounter_++), "Barrel.mesh");
    8181
    82     Vector3 speed = (temp->getOrientation() * Vector3(0, 0, -1))
     82    Vector3 speed = (temp->getOrientation() * Vector3(1, 0, 0))
    8383          .normalisedCopy() * primaryBulletSpeed_;
    8484    speed += getVelocity();
    8585
    86           temp->setScale(Vector3(1, 1, 1) * 4);
     86          temp->setScale(Vector3(1, 1, 1) * 2);
    8787          temp->yaw(Degree(-90));
    8888
     
    9797
    9898
    99   void BarrelGun::primaryFiring(unsigned int time)
     99  void BarrelGun::primaryFiring(float time)
    100100  {
    101     if (time > (unsigned int)1000/primaryFiringRate_)
     101    if (time > primaryFiringRate_)
    102102    {
    103103      currentState_ = IDLE;
     
    122122          + StringConverter::toString(bulletCounter_++), "Barrel.mesh");
    123123
    124     Vector3 speed = (temp->getOrientation() * Vector3(0, 0, -1))
     124    Vector3 speed = (temp->getOrientation() * Vector3(1, 0, 0))
    125125          .normalisedCopy() * secondaryBulletSpeed_*0.5;
    126126    speed += getVelocity();
    127127
    128           temp->setScale(Vector3(1, 1, 1) * 10);
     128          temp->setScale(Vector3(1, 1, 1) * 4);
    129129          temp->yaw(Degree(-90));
    130130
     
    140140
    141141
    142   void BarrelGun::secondaryFiring(unsigned int time)
     142  void BarrelGun::secondaryFiring(float time)
    143143  {
    144     if (time > (unsigned int)1000/secondaryFiringRate_)
     144    if (time > secondaryFiringRate_)
    145145      currentState_ = IDLE;
    146146  }
  • code/branches/FICN/src/orxonox/objects/weapon_system/barrel_gun.h

    r637 r645  
    4949    void primaryFire();
    5050
    51     void primaryFiring(unsigned int);
     51    void primaryFiring(float);
    5252
    5353    void secondaryFire();
    5454
    55     void secondaryFiring(unsigned int);
     55    void secondaryFiring(float);
    5656
    5757  public:
  • code/branches/FICN/src/orxonox/objects/weapon_system/base_weapon.cc

    r637 r645  
    4646 
    4747  CreateFactory(BaseWeapon);
     48
     49  float BaseWeapon::nextActionValidityPeriod_ = 0.5;
    4850
    4951  BaseWeapon::BaseWeapon()
     
    105107      {
    106108      case PRIMARY_FIRE:
    107         primaryFiring((unsigned int)(totalTime_ - actionStartTime_));
     109        primaryFiring(totalTime_ - actionStartTime_);
    108110        break;
    109111
    110112      case SECONDARY_FIRE:
    111         secondaryFiring((unsigned int)(totalTime_ - actionStartTime_));
     113        secondaryFiring(totalTime_ - actionStartTime_);
    112114        break;
    113115
  • code/branches/FICN/src/orxonox/objects/weapon_system/base_weapon.h

    r637 r645  
    7878    virtual void primaryFire() { };
    7979
    80     virtual void primaryFiring(unsigned int) { };
     80    virtual void primaryFiring(float) { };
    8181
    8282    virtual void secondaryFire() { };
    8383
    84     virtual void secondaryFiring(unsigned int) { };
     84    virtual void secondaryFiring(float) { };
    8585
    8686    inline void registerAllVariables() { }//Model::registerAllVariables(); }
     
    100100
    101101    float totalTime_;
    102     unsigned long actionStartTime_;
     102    float actionStartTime_;
    103103
    104104    State currentState_;
     
    107107    Action nextAction_;
    108108    bool actionAdded_;
    109     unsigned long timeSinceNextActionAdded_;
    110     static const unsigned long nextActionValidityPeriod_ = 500;
     109    float timeSinceNextActionAdded_;
     110    static float nextActionValidityPeriod_;
    111111
    112112    // weapon properties
    113113    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_;
    118118    Ogre::Real primaryBulletSpeed_;
    119119    Ogre::Real secondaryBulletSpeed_;
Note: See TracChangeset for help on using the changeset viewer.