Fixed respawn/health problems after shotgun death.

This commit is contained in:
Felix Ableitner 2013-08-25 22:49:52 +02:00
parent 21fa8ce0c5
commit b45dd01c72
2 changed files with 5 additions and 1 deletions

View file

@ -58,8 +58,11 @@ Character::onDamage(int damage) {
mCurrentHealth = mMaxHealth; mCurrentHealth = mMaxHealth;
if (mCurrentHealth <= 0) { if (mCurrentHealth <= 0) {
mCurrentHealth = 0; // Seperated to avoid firing multiple times (when damaged multiple times).
if (!mIsDead)
onDeath(); onDeath();
mIsDead = true;
mCurrentHealth = 0;
setDelete(true); setDelete(true);
} }
} }

View file

@ -93,6 +93,7 @@ private:
std::vector<Vector2f> mPath; //< Contains nodes to reach a set destination. std::vector<Vector2f> mPath; //< Contains nodes to reach a set destination.
Vector2f mLastPosition; Vector2f mLastPosition;
Faction mFaction; Faction mFaction;
bool mIsDead = false;
}; };
#endif /* DG_ACTOR_H_ */ #endif /* DG_ACTOR_H_ */