@ -25,7 +25,7 @@ const vi2d WINDOW_SIZE={24*15,24*10};
std : : map < AnimationState , Animate2D : : FrameSequence > ANIMATION_DATA ;
std : : vector < Monster > MONSTER_LIST ;
std : : vector < MonsterSpawner > SPAWNER_LIST ;
std : : vector < DamageNumber > DAMAGENUMBER_LIST ;
std : : vector < std : : shared_ptr < DamageNumber > > DAMAGENUMBER_LIST ;
std : : vector < std : : unique_ptr < Bullet > > BULLET_LIST ;
Crawler * game ;
@ -699,21 +699,26 @@ void Crawler::RenderWorld(float fElapsedTime){
}
}
# pragma endregion
for ( std : : vector < DamageNumber > : : iterator it = DAMAGENUMBER_LIST . begin ( ) ; it ! = DAMAGENUMBER_LIST . end ( ) ; + + it ) {
DamageNumber & dn = * it ;
dn . lifeTime + = fElapsedTime ;
if ( dn . lifeTime > 1 ) {
for ( std : : vector < std : : shared_ptr < DamageNumber > > : : iterator it = DAMAGENUMBER_LIST . begin ( ) ; it ! = DAMAGENUMBER_LIST . end ( ) ; + + it ) {
DamageNumber * dn = ( * it ) . get ( ) ;
if ( dn - > pauseTime > 0 ) {
dn - > pauseTime - = fElapsedTime ;
} else {
dn - > lifeTime + = fElapsedTime ;
if ( dn - > lifeTime > 1 ) {
it = DAMAGENUMBER_LIST . erase ( it ) ;
if ( it = = DAMAGENUMBER_LIST . end ( ) ) {
break ;
}
} else {
if ( dn . lifeTime < DamageNumber : : MOVE_UP_TIME ) {
dn . pos . y - = 20 * fElapsedTime ;
if ( dn - > lifeTime < DamageNumber : : MOVE_UP_TIME ) {
dn - > pos . y - = 20 * fElapsedTime ;
}
}
std : : string text = std : : to_string ( dn . damage ) ;
view . DrawStringPropDecal ( dn . pos - GetTextSizeProp ( text ) / 2 , text , DARK_RED ) ;
}
std : : string text = std : : to_string ( dn - > damage ) ;
view . DrawStringPropDecal ( dn - > pos - GetTextSizeProp ( text ) / 2 , text , DARK_RED ) ;
}
}