Changeset 10627 for code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.cc
- Timestamp:
- Oct 6, 2015, 9:37:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.cc
r10606 r10627 49 49 this->numberOfSplits_ = 0; 50 50 this->numberOfChilds_ = 0; 51 this->splitTime_ = 1.0; 52 this->spread_ = 0.2; 51 this->splitTime_ = 1.0f; 52 this->spread_ = 0.2f; 53 this->damageReduction_ = 1.0f; 53 54 } 54 55 … … 96 97 void SplitGunProjectile::setSpread(float spread) 97 98 { 98 spread_ = spread; 99 this->spread_ = spread; 100 } 101 102 /** 103 @brief 104 This is the setter function for the damageReduction_ variable. The value of the variable is bounded between 0 and 1. 105 */ 106 void SplitGunProjectile::setDamageReduction(float damageReduction) 107 { 108 this->damageReduction_ = (damageReduction >= 0.0f ? damageReduction : 1.0f); 99 109 } 100 110 … … 109 119 -- numberOfSplits_; 110 120 111 // Reduce damage of this projectile by the number of childs plus one. This way the total amount of possible damage contained in the original projectile and its childs is unchanged after s aplit.112 this->setDamage(this->getDamage() /(numberOfChilds_+1));121 // Reduce damage of this projectile 122 this->setDamage(this->getDamage() * this->damageReduction_ / (this->numberOfChilds_+1)); 113 123 114 124 // Calculate a normalized vector (velocityOffset) that is perpendicluar to the velocity of this projectile. Since there are infinitly many perpendicular vectors a random one is chosen. … … 138 148 projectile->setSplitTime(this->splitTime_); 139 149 projectile->setSpread(this->spread_); 150 projectile->setDamageReduction(this->damageReduction_); 140 151 141 152 projectile->setShooter(this->getShooter());
Note: See TracChangeset
for help on using the changeset viewer.