[Orxonox-commit 3498] r8184 - in code/branches/gameimmersion: data/levels src/orxonox/worldentities/pawns
simonmie at orxonox.net
simonmie at orxonox.net
Mon Apr 4 14:53:53 CEST 2011
Author: simonmie
Date: 2011-04-04 14:53:53 +0200 (Mon, 04 Apr 2011)
New Revision: 8184
Modified:
code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw
code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc
code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h
Log:
Added maxShieldHealth
Modified: code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw
===================================================================
--- code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw 2011-04-04 12:14:25 UTC (rev 8183)
+++ code/branches/gameimmersion/data/levels/test-immersion-shield-01.oxw 2011-04-04 12:53:53 UTC (rev 8184)
@@ -35,15 +35,16 @@
linearDamping= "0.9"
angularDamping= "0.7"
- health= 100
+ health= 200
maxhealth= 150
inithealth= 100
shieldhealth= 200
shieldabsorption= 1
+ maxshieldhealth= 250
reloadrate= "10"
- reloadwaittime= 5
+ reloadwaittime= 1
>
<attached>
Modified: code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc 2011-04-04 12:14:25 UTC (rev 8183)
+++ code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.cc 2011-04-04 12:53:53 UTC (rev 8184)
@@ -71,6 +71,8 @@
this->reloadRate_ = 0;
this->reloadWaitTime_ = 1.0f;
this->reloadWaitCountdown_ = 0;
+
+ this->maxShieldHealth_ = 0;
////////////////////////end me
this->lastHitOriginator_ = 0;
@@ -126,9 +128,10 @@
/////// me
XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
+ XMLPortParam(Pawn, "maxshieldhealth", setMaxShieldHealth, getMaxShieldHealth, xmlelement, mode).defaultValues(100);
/////// end me
-
+ //TODO: DEFINES fuer defaultwerte (hier und weiter oben dieselben)
}
void Pawn::registerVariables()
@@ -159,7 +162,6 @@
this->resetReloadCountdown();
}
- // TODO max. shield hinzufuegen
////////end me
if (GameMode::isMaster())
if (this->health_ <= 0 && bAlive_)
@@ -210,7 +212,16 @@
this->reloadWaitCountdown_ -= dt;
}
+ void Pawn::setMaxShieldHealth(float maxshieldhealth)
+ {
+ this->maxShieldHealth_ = maxshieldhealth;
+ }
+ void Pawn::setShieldHealth(float shieldHealth)
+ {
+ this->shieldHealth_ = std::min(shieldHealth, this->maxShieldHealth_);
+ }
+
///////////////end me
void Pawn::setHealth(float health)
@@ -218,6 +229,7 @@
this->health_ = std::min(health, this->maxHealth_);
}
+//////////////////me edit
void Pawn::damage(float damage, Pawn* originator)
{
if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
@@ -248,6 +260,7 @@
// play damage effect
}
}
+////////////////////end edit
void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
{
Modified: code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h 2011-04-04 12:14:25 UTC (rev 8183)
+++ code/branches/gameimmersion/src/orxonox/worldentities/pawns/Pawn.h 2011-04-04 12:53:53 UTC (rev 8184)
@@ -76,6 +76,10 @@
virtual void decreaseReloadCountdownTime(float dt);
+ virtual void setMaxShieldHealth(float maxshieldhealth);
+ inline float getMaxShieldHealth() const
+ { return this->maxShieldHealth_; }
+
///////////////////////////////// end me
virtual void setHealth(float health);
@@ -96,8 +100,8 @@
inline float getInitialHealth() const
{ return this->initialHealth_; }
- inline void setShieldHealth(float shieldHealth)
- { this->shieldHealth_ = shieldHealth; }
+ virtual void setShieldHealth(float shieldHealth);
+
inline float getShieldHealth()
{ return this->shieldHealth_; }
@@ -180,6 +184,8 @@
float reloadWaitTime_;
float reloadWaitCountdown_;
+ float maxShieldHealth_;
+
////////////////////////// end me
float health_;
More information about the Orxonox-commit
mailing list