[Orxonox-commit 5935] r10594 - in code/branches/towerdefenseFabien: data/levels src/modules/weapons/projectiles src/modules/weapons/weaponmodes

fvultier at orxonox.net fvultier at orxonox.net
Fri Sep 25 13:56:51 CEST 2015


Author: fvultier
Date: 2015-09-25 13:56:51 +0200 (Fri, 25 Sep 2015)
New Revision: 10594

Modified:
   code/branches/towerdefenseFabien/data/levels/towerDefense.oxw
   code/branches/towerdefenseFabien/src/modules/weapons/projectiles/CMakeLists.txt
   code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.cc
   code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.h
   code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.cc
   code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.h
Log:
improved documentation

Modified: code/branches/towerdefenseFabien/data/levels/towerDefense.oxw
===================================================================
--- code/branches/towerdefenseFabien/data/levels/towerDefense.oxw	2015-09-24 11:25:08 UTC (rev 10593)
+++ code/branches/towerdefenseFabien/data/levels/towerDefense.oxw	2015-09-25 11:56:51 UTC (rev 10594)
@@ -219,7 +219,7 @@
           <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
         </links>
         <Weapon>
-          <SimpleRocketFire mode=0 muzzleoffset="0,0,0" damage=30 shielddamage=20 />
+          <<HsW01 mode=0 munitionpershot=0 delay=0.125 damage=9.3 material="Flares/point_lensflare" muzzleoffset=" 0,0,0" projectileMesh="LaserBeam2.mesh" />
         </Weapon>
       </WeaponPack>
     </weapons>

Modified: code/branches/towerdefenseFabien/src/modules/weapons/projectiles/CMakeLists.txt
===================================================================
--- code/branches/towerdefenseFabien/src/modules/weapons/projectiles/CMakeLists.txt	2015-09-24 11:25:08 UTC (rev 10593)
+++ code/branches/towerdefenseFabien/src/modules/weapons/projectiles/CMakeLists.txt	2015-09-25 11:56:51 UTC (rev 10594)
@@ -4,7 +4,6 @@
   ParticleProjectile.cc
   Projectile.cc
   LightningGunProjectile.cc
-  SplitGunProjectile.cc
   Rocket.cc
   SimpleRocket.cc
   SplitGunProjectile.cc

Modified: code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.cc
===================================================================
--- code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.cc	2015-09-24 11:25:08 UTC (rev 10593)
+++ code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.cc	2015-09-25 11:56:51 UTC (rev 10594)
@@ -20,7 +20,7 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Joel Smely
+ *      Fabien Vultier
  *   Co-authors:
  *      ...
  *
@@ -76,6 +76,10 @@
         }
     }
 
+    /**
+    @brief
+        This function starts a timer that will cause the projectile to split after a time defined by the argument @param splitTime.        
+    */
     void SplitGunProjectile::setSplitTime(float splitTime)
     {
         if (splitTime >= 0)
@@ -94,12 +98,19 @@
         spread_ = spread;
     }
 
+    /**
+    @brief
+        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.
+    */
     void SplitGunProjectile::split()
     {
         if (numberOfSplits_ > 0)
         {
             -- numberOfSplits_;
 
+            // 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.
+            this->setDamage(this->getDamage()/(numberOfChilds_+1));
+
             // 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.
             Vector3 velocityInitial = this->getVelocity();
             Vector3 velocityOffset = velocityInitial.perpendicular();
@@ -130,7 +141,7 @@
                 projectile->setShooter(this->getShooter());
                 projectile->setDamage(this->getDamage());
                 projectile->setShieldDamage(this->getShieldDamage());
-                projectile->setHealthDamage(this->getHealthDamage());                
+                projectile->setHealthDamage(this->getHealthDamage());
             }
 
             numberOfSplits_ = 0;

Modified: code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.h
===================================================================
--- code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.h	2015-09-24 11:25:08 UTC (rev 10593)
+++ code/branches/towerdefenseFabien/src/modules/weapons/projectiles/SplitGunProjectile.h	2015-09-25 11:56:51 UTC (rev 10594)
@@ -20,7 +20,7 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Joel Smely
+ *      Fabien Vultier
  *   Co-authors:
  *      ...
  *
@@ -45,10 +45,9 @@
 
     /**
     @brief
-        The SplitGunProjectile is a projectile that is represented by a looped series of billboards.
-        
+        The SplitGunProjectile is a projectile that may split up into many child projectiles.
     @author
-        Joel Smely
+        Fabien Vultier
     @ingroup WeaponsProjectiles
     */
     class _WeaponsExport SplitGunProjectile : public BillboardProjectile

Modified: code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.cc
===================================================================
--- code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.cc	2015-09-24 11:25:08 UTC (rev 10593)
+++ code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.cc	2015-09-25 11:56:51 UTC (rev 10594)
@@ -20,9 +20,9 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Joel Smely
+ *      Fabien Vultier
  *   Co-authors:
- *      simonmie
+ *      ...
  *
  */
 
@@ -68,7 +68,7 @@
 
     /**
     @brief
-        XMLPort for the SplitGun. You can define how often the projectiles split, how many childs should be created per split and the time between two splits.
+        XMLPort for the SplitGun. You can define how often the projectiles split, how many childs should be created per split, the spread and the time between two splits.
     */
     void SplitGun::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
@@ -94,6 +94,7 @@
         projectile->setPosition(this->getMuzzlePosition());
         projectile->setVelocity(this->getMuzzleDirection() * this->speed_);
 
+        // Pass important information to the projectile: Number of splits, Number of childs, split time, spread
         projectile->setNumberOfSplits(getNumberOfSplits());
         projectile->setNumberOfChilds(getNumberOfChilds());
         projectile->setSplitTime(getSplitTime());

Modified: code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.h
===================================================================
--- code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.h	2015-09-24 11:25:08 UTC (rev 10593)
+++ code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/SplitGun.h	2015-09-25 11:56:51 UTC (rev 10594)
@@ -20,7 +20,7 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Joel Smely
+ *      Fabien Vultier
  *   Co-authors:
  *      ...
  *
@@ -44,7 +44,7 @@
     @brief
         A slow ball of lightning.
     @author
-        Joel Smely
+        Fabien Vultier
     @ingroup WeaponsWeaponModes
     */
     class _WeaponsExport SplitGun : public WeaponMode
@@ -74,11 +74,11 @@
                 { return this->spread_; }
 
        private:
-            float speed_; //!< The speed of the fired projectile.
-            int numberOfSplits_;
-            int numberOfChilds_;
-            float splitTime_;
-            float spread_;
+            float speed_; //The speed of the fired projectile.
+            int numberOfSplits_; //The number of times the projectile will split into child projectiles
+            int numberOfChilds_; //The number of child projectiles that are created if the projectile splits
+            float splitTime_; //The time between creation of the projectile and the split of the projectile
+            float spread_; //Low spread means that the child projectiles are concentrated in a small area
     };
 }
 




More information about the Orxonox-commit mailing list