Changeset 10594 for code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.cc
- Timestamp:
- Sep 25, 2015, 1:56:51 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.cc
r10592 r10594 21 21 * 22 22 * Author: 23 * Joel Smely23 * Fabien Vultier 24 24 * Co-authors: 25 25 * ... … … 77 77 } 78 78 79 /** 80 @brief 81 This function starts a timer that will cause the projectile to split after a time defined by the argument @param splitTime. 82 */ 79 83 void SplitGunProjectile::setSplitTime(float splitTime) 80 84 { … … 95 99 } 96 100 101 /** 102 @brief 103 If this function is called the projectile splits up into many child projectiles. The original projectiles does not get destroyed but it will never split up again. 104 */ 97 105 void SplitGunProjectile::split() 98 106 { … … 100 108 { 101 109 -- numberOfSplits_; 110 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)); 102 113 103 114 // 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. … … 131 142 projectile->setDamage(this->getDamage()); 132 143 projectile->setShieldDamage(this->getShieldDamage()); 133 projectile->setHealthDamage(this->getHealthDamage()); 144 projectile->setHealthDamage(this->getHealthDamage()); 134 145 } 135 146
Note: See TracChangeset
for help on using the changeset viewer.