Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 5, 2008, 7:57:16 PM (15 years ago)
Author:
polakma
Message:

added firemodes and a lot of other things

File:
1 edited

Legend:

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

    r2097 r2145  
    4141        RegisterObject(LaserGun);
    4242
    43         projectileColor_ = ColourValue(1.0, 1.0, 0.5)
     43        this->attachNeededMunition();
     44
     45        //set weapon properties here
     46        this->projectileColor_ = ColourValue(1.0, 1.0, 0.5)
     47        this->loadingTime_ = 0.5;
    4448    }
    4549
     
    5054    LaserGun::fire()
    5155    {
     56        if { this->weaponReadyToShoot_ }
     57        {
     58            this->weaponReadyToShoot_ = false;
     59            //take munition
     60            //this->pointerToMunition_->
     61
     62            this->reloadTimer_.setTimer( loadingTime_ , false , this , &this->reloaded );
     63
    5264            BillboardProjectile* projectile = new ParticleProjectile(this);
    53             projectile->setColour(this->projectileColor_);
    54             projectile->create();
    55             if (projectile->getClassID() == 0)
    56             {
    57               COUT(3) << "generated projectile with classid 0" <<  std::endl; // TODO: remove this output
    58             }
    59 
    60             projectile->setObjectMode(0x3);
    61     }
    62 
    63     LaserGun::addMunition()
    64     {
    65         //this->munition_ = ;
     65            projectile->setColour(this->getProjectileColour());
     66        }
     67        else
     68        {
     69            //actions, when weapon is not reloaded
     70        }
    6671    }
    6772
     
    7580        return projectileColor_;
    7681    }
     82
     83    void attachNeededMunition(Munition *pointerToMunition)
     84    {
     85        //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
     86        if ( this->parentWeaponSystem_->munitionSet_[laserGunMunition] )
     87            this->pointerToMunition_ = pointerToMunition;
     88        else
     89        {
     90            this->pointerToMunition_ = new LaserGunMunition;
     91
     92        }
     93    }
    7794}
Note: See TracChangeset for help on using the changeset viewer.