Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 29, 2015, 9:05:26 PM (9 years ago)
Author:
fvultier
Message:

promised wor for Jannis.

Location:
code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/MineGun.cc

    r10836 r10889  
    5151        RegisterObject(MineGun);
    5252
     53        this->speed_ = 0.0f;
    5354        this->reloadTime_ = 1.0f;
    5455        this->damage_ = 0.0f;
    55         this->speed_ = 0.0f;
    56         this->lifeTime_ = 7500.0f;
     56        this->maxTimeUntilExplosion_ = 0.0f;
    5757
    5858        this->setMunitionName("MineMunition");
     
    6666    /**
    6767    @brief
    68         XMLPort for the MineGun. You can define how often the projectiles Mine, how many childs should be created per Mine, the spread and the time between two Mines.
     68        XMLPort for the MineGun.
    6969    */
    7070    void MineGun::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    7171    {
    7272        SUPER(MineGun, XMLPort, xmlelement, mode);
    73         XMLPortParam(MineGun, "Lifetime", setLifeTime, getLifeTime, xmlelement, mode);
     73
     74        XMLPortParam(MineGun, "maxtimeuntilexplosion", setMaxTimeUntilExplosion, getMaxTimeUntilExplosion, xmlelement, mode).defaultValues(10.0f);
     75        XMLPortParam(MineGun, "timeuntilactivation", setTimeUntilActivation, getTimeUntilActivation, xmlelement, mode).defaultValues(3.0f);
    7476    }
    7577
     
    8183    {
    8284        MineProjectile* projectile = new MineProjectile(this->getContext());
    83         //projectile->setMaterial("Flares/energyflare");
    8485
    8586        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
     
    8889        projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
    8990
    90         // Pass important information to the projectile: Number of Mines, Number of childs, Mine time, spread and the damage reduction
    91         /*projectile->setNumberOfMines(getNumberOfMines());
    92         projectile->setNumberOfChilds(getNumberOfChilds());*/
    93         projectile->setLifeTime(getLifeTime());
    94         /*projectile->setSpread(getSpread());
    95         projectile->setDamageReduction(getDamageReduction());*/
     91        projectile->setMaxTimeUntilExplosion(getMaxTimeUntilExplosion());
     92        projectile->setTimeUntilActivation(getTimeUntilActivation());
    9693
    9794        projectile->setShooter(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
  • code/branches/particleEffectsHS15/src/modules/weapons/weaponmodes/MineGun.h

    r10836 r10889  
    4444    @brief
    4545        A Mine that explodes when a ship is too close
    46     @author
    47         Fabien Vultier
    4846    @ingroup WeaponsWeaponModes
    4947    */
     
    5654            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5755            virtual void fire();
    58             inline void setLifeTime(float lifeTime)
    59                 { this->lifeTime_ = lifeTime; }
    60             inline float getLifeTime() const
    61                 { return this->lifeTime_; }
    6256
    63        private:
     57            inline float getMaxTimeUntilExplosion() const
     58                { return this->maxTimeUntilExplosion_; }
     59            inline float getTimeUntilActivation() const
     60                { return this->timeUntilActivation_; }
     61        protected:
     62            inline void setMaxTimeUntilExplosion(float maxTimeUntilExplosion)
     63                { this->maxTimeUntilExplosion_ = maxTimeUntilExplosion; }
     64            inline void setTimeUntilActivation(float timeUntilActivation)
     65                { this->timeUntilActivation_ = timeUntilActivation; }
     66        private:
    6467            float speed_; //The speed of the fired projectile.
    65             float lifeTime_;
    66 
     68            float maxTimeUntilExplosion_;
     69            float timeUntilActivation_;
    6770    };
    6871}
Note: See TracChangeset for help on using the changeset viewer.