Switch to smart pointer implementation for damage numbers to handle damage combo'ing quick attack displays.
This commit is contained in:
+10
-1
@@ -98,6 +98,7 @@ bool Monster::SetY(float y){
|
||||
return false;
|
||||
}
|
||||
bool Monster::Update(float fElapsedTime){
|
||||
lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime);
|
||||
if(IsAlive()){
|
||||
for(std::vector<Buff>::iterator it=buffList.begin();it!=buffList.end();++it){
|
||||
Buff&b=*it;
|
||||
@@ -334,7 +335,15 @@ bool Monster::Hurt(int damage,bool onUpperLevel){
|
||||
mod_dmg-=damage*b.intensity;
|
||||
}
|
||||
hp=std::max(0,hp-int(mod_dmg));
|
||||
DAMAGENUMBER_LIST.push_back(DamageNumber(pos,int(mod_dmg)));
|
||||
if(lastHitTimer>0){
|
||||
damageNumberPtr.get()->damage+=int(mod_dmg);
|
||||
damageNumberPtr.get()->pauseTime=0.4;
|
||||
} else {
|
||||
DAMAGENUMBER_LIST.push_back(std::make_shared<DamageNumber>(pos,int(mod_dmg)));
|
||||
std::shared_ptr<DamageNumber>numb=*(DAMAGENUMBER_LIST.end()-1);
|
||||
damageNumberPtr=numb;
|
||||
}
|
||||
lastHitTimer=0.05;
|
||||
if(hp<=0){
|
||||
animation.ChangeState(internal_animState,GetDeathAnimationName());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user