Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 19, 2008, 7:07:36 PM (16 years ago)
Author:
polakma
Message:

added new features to munition.h and weapon.h. tried to fix projectiles (still doesn't compile)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weapon2/src/orxonox/objects/weaponSystem/Weapon.cc

    r2203 r2232  
    4040    {
    4141        RegisterObject(Weapon);
    42         this->weaponReadyToShoot_ = true;
     42        this->bulletReadyToShoot_ = true;
     43        this->magazineReadyToShoot_ = true;
    4344        this->setParentWeaponSystem();
    4445    }
     
    5152    void Weapon::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5253    {
    53 
     54        SUPER(Weapon, XMLPort, xmlelement, mode);
    5455    }
    5556
     
    5859
    5960    }
    60     void Weapon::timer()
     61
     62
     63    void Weapon::bulletTimer()
    6164    {
    62         this->reloadTimer_.setTimer( this->loadingTime_ , false , this , createExecutor(createFunctor(&Weapon::reloaded)));
     65        this->bulletReloadTimer_.setTimer( this->bulletLoadingTime_ , false , this , createExecutor(createFunctor(&Weapon::bulletReloaded)));
     66    }
     67    void Weapon::magazineTimer()
     68    {
     69        this->magazineReloadTimer_.setTimer( this->magazineLoadingTime_ , false , this , createExecutor(createFunctor(&Weapon::magazineReloaded)));
    6370    }
    6471
    65     void Weapon::reloaded()
    66     {
     72    void Weapon::bulletReloaded()
     73    { this->bulletReadyToShoot_ = true; }
    6774
    68         this->weaponReadyToShoot_ = true;
    69     }
     75    void Weapon::magazineReloaded()
     76    { this->magazineReadyToShoot_ = true; }
     77
    7078
    7179    void Weapon::attachNeededMunition(std::string munitionName)
    7280    {
    73         //if munition type already exist attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem
     81        //if munition type already exists attach it, else create a new one of this type and attach it to the weapon and to the WeaponSystem
    7482        if ( this->parentWeaponSystem_->getMunitionType(munitionName) )
    7583            this->munition_ = this->parentWeaponSystem_->getMunitionType(munitionName);
     
    93101    {   return this->munition_; }
    94102
    95     void Weapon::setLoadingTime(float loadingTime)
    96     {   this->loadingTime_ = loadingTime;   }
     103    void Weapon::setBulletLoadingTime(float loadingTime)
     104    {   this->bulletLoadingTime_ = loadingTime;   }
    97105
    98     float Weapon::getLoadingTime()
    99     {   return this->loadingTime_;  }
     106    float Weapon::getBulletLoadingTime()
     107    {   return this->bulletLoadingTime_;  }
    100108
    101     void Weapon::setWeaponReadyToShoot(bool b)
    102     {   this->weaponReadyToShoot_ = b;   }
     109    void Weapon::setMagazineLoadingTime(float loadingTime)
     110    {   this->magazineLoadingTime_ = loadingTime;   }
    103111
    104     bool Weapon::getWeaponReadyToShoot()
    105     {   return this->weaponReadyToShoot_;    }
    106     Timer<Weapon> * Weapon::getTimer()
    107     {   return &this->reloadTimer_;   }
     112    float Weapon::getMagazineLoadingTime()
     113    {   return this->magazineLoadingTime_;  }
     114
     115    void Weapon::setBulletReadyToShoot(bool b)
     116    {   this->bulletReadyToShoot_ = b;   }
     117
     118    bool Weapon::getBulletReadyToShoot()
     119    {   return this->bulletReadyToShoot_;    }
     120
     121    void Weapon::setMagazineReadyToShoot(bool b)
     122    {   this->magazineReadyToShoot_ = b;   }
     123
     124    bool Weapon::getMagazineReadyToShoot()
     125    {   return this->magazineReadyToShoot_;    }
     126
     127    Timer<Weapon> * Weapon::getBulletTimer()
     128    {   return &this->bulletReloadTimer_;   }
     129
     130    Timer<Weapon> * Weapon::getMagazineTimer()
     131    {   return &this->magazineReloadTimer_;   }
    108132}
Note: See TracChangeset for help on using the changeset viewer.