[Orxonox-commit 5949] r10608 - in code/branches/towerdefenseFabien/src/modules/weapons: . projectiles weaponmodes

fvultier at orxonox.net fvultier at orxonox.net
Fri Oct 2 23:03:31 CEST 2015


Author: fvultier
Date: 2015-10-02 23:03:31 +0200 (Fri, 02 Oct 2015)
New Revision: 10608

Modified:
   code/branches/towerdefenseFabien/src/modules/weapons/IceGunFreezer.cc
   code/branches/towerdefenseFabien/src/modules/weapons/IceGunFreezer.h
   code/branches/towerdefenseFabien/src/modules/weapons/projectiles/IceGunProjectile.cc
   code/branches/towerdefenseFabien/src/modules/weapons/projectiles/IceGunProjectile.h
   code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/IceGun.cc
   code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/IceGun.h
Log:
Improved documentation

Modified: code/branches/towerdefenseFabien/src/modules/weapons/IceGunFreezer.cc
===================================================================
--- code/branches/towerdefenseFabien/src/modules/weapons/IceGunFreezer.cc	2015-10-02 20:48:17 UTC (rev 10607)
+++ code/branches/towerdefenseFabien/src/modules/weapons/IceGunFreezer.cc	2015-10-02 21:03:31 UTC (rev 10608)
@@ -91,13 +91,19 @@
         freezeFactor_ = freezeFactor;
     }    
 
+    /**
+    @brief
+        Try to slow down the WorldEntity where this is attached to. It is only possible to slow down a SpaceShip.
+    */
     void IceGunFreezer::startFreezing()
     {
         WorldEntity* parent = this->getParent();
 
+        // Check if the freezer is attached to a parent and check if the parent is a SpaceShip
         if (parent != NULL && parent->isA(Class(SpaceShip)))
         {
             freezedSpaceShip_ = orxonox_cast<SpaceShip*>(parent);
+            //Slow down the SpaceShip
             freezedSpaceShip_->addSpeedFactor(freezeFactor_);
         }
 
@@ -105,6 +111,10 @@
         this->freezeTimer_.setTimer(this->freezeTime_, false, createExecutor(createFunctor(&IceGunFreezer::stopFreezing, this)));
     }
 
+    /**
+    @brief
+        This method is called by the timer. It gives back the original engine strength to the hit SpaceShip.
+    */
     void IceGunFreezer::stopFreezing()
     {
         if (freezedSpaceShip_ != NULL && freezeFactor_ != 0.0)

Modified: code/branches/towerdefenseFabien/src/modules/weapons/IceGunFreezer.h
===================================================================
--- code/branches/towerdefenseFabien/src/modules/weapons/IceGunFreezer.h	2015-10-02 20:48:17 UTC (rev 10607)
+++ code/branches/towerdefenseFabien/src/modules/weapons/IceGunFreezer.h	2015-10-02 21:03:31 UTC (rev 10608)
@@ -46,7 +46,7 @@
 {
     /**
     @brief
-        blablabla
+        This is the WorldEntity that gets attached to a victim hit by a IceGunProjectile. It slows down the hit SpaceShip by a defined amount and time.
     @ingroup Weapons
     */
     class _WeaponsExport IceGunFreezer : public StaticEntity, public Tickable

Modified: code/branches/towerdefenseFabien/src/modules/weapons/projectiles/IceGunProjectile.cc
===================================================================
--- code/branches/towerdefenseFabien/src/modules/weapons/projectiles/IceGunProjectile.cc	2015-10-02 20:48:17 UTC (rev 10607)
+++ code/branches/towerdefenseFabien/src/modules/weapons/projectiles/IceGunProjectile.cc	2015-10-02 21:03:31 UTC (rev 10608)
@@ -75,11 +75,12 @@
     }
 
     bool IceGunProjectile::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
-    {
+    {        
         bool bCollision = Projectile::collidesAgainst(otherObject, cs, contactPoint);
 
         if (bCollision)
         {
+            // If there was a collision, attach a IceGunFreezer to the hit object.
             IceGunFreezer* freezer = new IceGunFreezer(this->getContext());
             freezer->setFreezeTime(freezeTime_);
             freezer->setFreezeFactor(freezeFactor_);
@@ -88,6 +89,7 @@
             Vector3 offset = this->getWorldPosition() - otherObject->getWorldPosition();
             freezer->setPosition(Vector3(0,0,0));
             freezer->translate(offset, WorldEntity::World);
+            // Start the freezing effect.
             freezer->startFreezing();
         }
 

Modified: code/branches/towerdefenseFabien/src/modules/weapons/projectiles/IceGunProjectile.h
===================================================================
--- code/branches/towerdefenseFabien/src/modules/weapons/projectiles/IceGunProjectile.h	2015-10-02 20:48:17 UTC (rev 10607)
+++ code/branches/towerdefenseFabien/src/modules/weapons/projectiles/IceGunProjectile.h	2015-10-02 21:03:31 UTC (rev 10608)
@@ -46,7 +46,7 @@
 
     /**
     @brief
-        The IceGunProjectile is a projectile that may split up into many child projectiles.
+        The IceGunProjectile is a projectile that attaches a IceGunFreezer to the hit object. This object gets slowed down by the IceGunFreezer.
     @author
         Fabien Vultier
     @ingroup WeaponsProjectiles

Modified: code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/IceGun.cc
===================================================================
--- code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/IceGun.cc	2015-10-02 20:48:17 UTC (rev 10607)
+++ code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/IceGun.cc	2015-10-02 21:03:31 UTC (rev 10608)
@@ -50,11 +50,11 @@
     {
         RegisterObject(IceGun);
 
+        // Default values
         this->reloadTime_ = 1.0f;
         this->damage_ = 0.0f;
         this->speed_ = 750.0f;
 
-
         this->setFreezeTime(3.0);
         this->setFreezeFactor(0.5);
 

Modified: code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/IceGun.h
===================================================================
--- code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/IceGun.h	2015-10-02 20:48:17 UTC (rev 10607)
+++ code/branches/towerdefenseFabien/src/modules/weapons/weaponmodes/IceGun.h	2015-10-02 21:03:31 UTC (rev 10608)
@@ -42,7 +42,7 @@
 
     /**
     @brief
-        A slow ball of lightning.
+        A Gun that fires ice arrows that slow down any SpaceShip object that gets hit.
     @author
         Fabien Vultier
     @ingroup WeaponsWeaponModes
@@ -55,7 +55,6 @@
 
             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
             virtual void fire();
-
             
             inline void setFreezeTime(float freezeTime)
                 { this->freezeTime_ = freezeTime; }




More information about the Orxonox-commit mailing list