[Orxonox-commit 3466] r8152 - in code/branches/gameimmersion: data/levels src/modules/weapons/projectiles src/orxonox/worldentities/pawns

simonmie at orxonox.net simonmie at orxonox.net
Mon Mar 28 16:43:18 CEST 2011


Author: simonmie
Date: 2011-03-28 16:43:18 +0200 (Mon, 28 Mar 2011)
New Revision: 8152

Modified:
   code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw
   code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc
   code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc
   code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h
Log:
added nice particleEffect if shield is hit


Modified: code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw
===================================================================
--- code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw	2011-03-28 14:39:32 UTC (rev 8151)
+++ code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw	2011-03-28 14:43:18 UTC (rev 8152)
@@ -55,8 +55,6 @@
 
 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
 
-<Model mesh="hs-w01.mesh" scale=10 position="0,0,-100" />
-<Model mesh="hs-w01s.mesh" scale=10 position="0,0,-100" />
 
     <?lua
       for i = 1, 10, 1 do

Modified: code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc
===================================================================
--- code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc	2011-03-28 14:39:32 UTC (rev 8151)
+++ code/branches/gameimmersion/src/modules/weapons/projectiles/Projectile.cc	2011-03-28 14:43:18 UTC (rev 8152)
@@ -102,8 +102,11 @@
 
             this->bDestroy_ = true;
 
+            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
+
             if (this->owner_)
             {
+                if (victim && !victim->hasShield())
                 {
                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
                     effect->setPosition(this->getPosition());
@@ -112,6 +115,7 @@
                     effect->setSource("Orxonox/explosion3");
                     effect->setLifetime(2.0f);
                 }
+                if (victim && !victim->hasShield())
                 {
                     ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
                     effect->setPosition(this->getPosition());
@@ -120,9 +124,17 @@
                     effect->setSource("Orxonox/smoke4");
                     effect->setLifetime(3.0f);
                 }
+                if (victim && victim->hasShield())
+                {
+                    ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
+                    effect->setPosition(this->getPosition());
+                    effect->setOrientation(this->getOrientation());
+                    effect->setDestroyAfterLife(true);
+                    effect->setSource("Orxonox/engineglow");
+                    effect->setLifetime(0.5f);
+                }
             }
 
-            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
             if (victim)
                 victim->hit(this->owner_, contactPoint, this->damage_);
         }

Modified: code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc	2011-03-28 14:39:32 UTC (rev 8151)
+++ code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc	2011-03-28 14:43:18 UTC (rev 8152)
@@ -144,6 +144,7 @@
 
 ////////me
         this->addShieldHealth(this->getReloadRate() * dt);
+	// TODO max. shield hinzufuegen
 ////////end me
         if (GameMode::isMaster())
             if (this->health_ <= 0 && bAlive_)

Modified: code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h	2011-03-28 14:39:32 UTC (rev 8151)
+++ code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h	2011-03-28 14:43:18 UTC (rev 8152)
@@ -61,6 +61,9 @@
             inline void addShieldHealth(float amount)
             { this->setShieldHealth(this->shieldHealth_ + amount); }
 
+            inline bool hasShield()
+            { return (this->getShieldHealth() > 0); }
+
 ///////////////////////////////// end me
 
             virtual void setHealth(float health);




More information about the Orxonox-commit mailing list