Fixed respawn/health problems after shotgun death.
This commit is contained in:
parent
21fa8ce0c5
commit
b45dd01c72
2 changed files with 5 additions and 1 deletions
|
@ -58,8 +58,11 @@ Character::onDamage(int damage) {
|
||||||
mCurrentHealth = mMaxHealth;
|
mCurrentHealth = mMaxHealth;
|
||||||
|
|
||||||
if (mCurrentHealth <= 0) {
|
if (mCurrentHealth <= 0) {
|
||||||
|
// Seperated to avoid firing multiple times (when damaged multiple times).
|
||||||
|
if (!mIsDead)
|
||||||
|
onDeath();
|
||||||
|
mIsDead = true;
|
||||||
mCurrentHealth = 0;
|
mCurrentHealth = 0;
|
||||||
onDeath();
|
|
||||||
setDelete(true);
|
setDelete(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_ */
|
||||||
|
|
Reference in a new issue