|
|
|
@ -223,6 +223,7 @@ void Unit::DrawRangeIndicator(PixelGameEngine*pge,TileTransformedView&game,std:: |
|
|
|
|
float dist=geom2d::line<float>(game.ScreenToWorld(pge->GetMousePos()),GetGhostPos()).length(); |
|
|
|
|
float range=12*(GetRange()+1); |
|
|
|
|
float totalRange=GetUnitSize().x/2+range; |
|
|
|
|
|
|
|
|
|
if(IsSelected()){ |
|
|
|
|
Pixel col; |
|
|
|
|
if(CanInteractWithAllies()&&!CanInteractWithEnemies()){ |
|
|
|
@ -231,6 +232,7 @@ void Unit::DrawRangeIndicator(PixelGameEngine*pge,TileTransformedView&game,std:: |
|
|
|
|
col={0,196,0}; |
|
|
|
|
} |
|
|
|
|
game.DrawRotatedDecal(GetGhostPos(),IMAGES[RANGE_INDICATOR]->Decal(),0,IMAGES[RANGE_INDICATOR]->Sprite()->Size()/2,{totalRange/12,totalRange/12},col); |
|
|
|
|
|
|
|
|
|
}else |
|
|
|
|
if(dist<range*2){ |
|
|
|
|
Pixel col; |
|
|
|
@ -247,7 +249,8 @@ void Unit::DrawRangeIndicator(PixelGameEngine*pge,TileTransformedView&game,std:: |
|
|
|
|
col={196,130,0}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
game.DrawRotatedDecal(GetGhostPos(),IMAGES[RANGE_INDICATOR]->Decal(),0,IMAGES[RANGE_INDICATOR]->Sprite()->Size()/2,{totalRange/12,totalRange/12},{col.r,col.g,col.b,uint8_t((1.f-(dist/(range*2)))*255)}); |
|
|
|
|
uint8_t transparency=uint8_t((1.f-(dist/(range*2)))*255); |
|
|
|
|
game.DrawRotatedDecal(GetGhostPos(),IMAGES[RANGE_INDICATOR]->Decal(),0,IMAGES[RANGE_INDICATOR]->Sprite()->Size()/2,{totalRange/12,totalRange/12},{col.r,col.g,col.b,transparency}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -310,6 +313,40 @@ void Unit::DrawHud(TileTransformedView&game,std::map<Image,std::unique_ptr<Rende |
|
|
|
|
float(initialBarY)},CONSTANT::BAR_SQUARE_SIZE,ghostMemory[i]?col:col/4); |
|
|
|
|
game.DrawRectDecal({float(initialBarX)+i*CONSTANT::BAR_SQUARE_SIZE.x, |
|
|
|
|
float(initialBarY)},CONSTANT::BAR_SQUARE_SIZE,BLACK); |
|
|
|
|
}
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Unit::DrawUnitDamageStats(PixelGameEngine*pge,TileTransformedView&game,std::map<Image,std::unique_ptr<Renderable>>&IMAGES){ |
|
|
|
|
float dist=geom2d::line<float>(game.ScreenToWorld(pge->GetMousePos()),GetGhostPos()).length(); |
|
|
|
|
float range=12*(GetRange()+1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto DrawStatDown=[&](Marker&maxStat,int currentStat,vf2d pos,vf2d downDisplayPos,Image img,uint8_t transparency=255){ |
|
|
|
|
if(maxStat.size>0){ |
|
|
|
|
if(currentStat!=maxStat.size){ |
|
|
|
|
game.DrawDecal(this->pos+pos,IMAGES[img]->Decal(),{1,1},{255,255,255,transparency}); |
|
|
|
|
if(currentStat>0){ |
|
|
|
|
game.DrawDecal(this->pos+downDisplayPos,IMAGES[DOWN_ARROW]->Decal(),{1,1},{255,255,255,transparency}); |
|
|
|
|
} else { |
|
|
|
|
game.DrawDecal(this->pos+downDisplayPos,IMAGES[RED_X]->Decal(),{1,1},{255,255,255,transparency}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if(IsSelected()){ |
|
|
|
|
DrawStatDown(atkSpd,GetAtkSpd(),{-48-8,-24},{-48+8,-18},RLD); |
|
|
|
|
DrawStatDown(moveSpd,GetMoveSpd(),{-48-8,8},{-48+8,2},SPD); |
|
|
|
|
DrawStatDown(this->range,GetRange(),{8,-24},{36,-18},RNG); |
|
|
|
|
DrawStatDown(procedure,GetProcedure(),{8,8},{36,2},PRC); |
|
|
|
|
}else |
|
|
|
|
if(dist<range*2){ |
|
|
|
|
uint8_t transparency=uint8_t((1.f-(dist/(range*2)))*255); |
|
|
|
|
DrawStatDown(atkSpd,GetAtkSpd(),{-48-8,-24},{-48+8,-18},RLD,transparency); |
|
|
|
|
DrawStatDown(moveSpd,GetMoveSpd(),{-48-8,8},{-48+8,2},SPD,transparency); |
|
|
|
|
DrawStatDown(this->range,GetRange(),{8,-24},{26,-18},RNG,transparency); |
|
|
|
|
DrawStatDown(procedure,GetProcedure(),{8,8},{26,2},PRC,transparency); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|