|
|
|
@ -184,7 +184,16 @@ Unit::Unit(std::vector<Memory>memory,vf2d pos,Renderable&img,bool friendly,bool |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Unit::DrawRangeIndicator(PixelGameEngine*pge,TileTransformedView&game,std::map<Image,std::unique_ptr<Renderable>>&IMAGES){ |
|
|
|
|
float dist=geom2d::line<float>(game.ScreenToWorld(pge->GetMousePos()),GetPos()).length(); |
|
|
|
|
float range=12*(GetRange()+1); |
|
|
|
|
if(IsSelected()){ |
|
|
|
|
game.DrawRotatedDecal(GetPos(),IMAGES[RANGE_INDICATOR]->Decal(),0,IMAGES[RANGE_INDICATOR]->Sprite()->Size()/2,{range/12,range/12},{0,196,0,128}); |
|
|
|
|
}else |
|
|
|
|
if(dist<range*2){ |
|
|
|
|
game.DrawRotatedDecal(GetPos(),IMAGES[RANGE_INDICATOR]->Decal(),0,IMAGES[RANGE_INDICATOR]->Sprite()->Size()/2,{range/12,range/12},{0,196,0,uint8_t((1.f-(dist/(range*2)))*128)}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Unit::Draw(TileTransformedView&game,std::map<Image,std::unique_ptr<Renderable>>&IMAGES){ |
|
|
|
|
game.DrawRotatedDecal(ghostPos,img.Decal(),0,img.Sprite()->Size()/2,{1,1},friendly?Pixel{192,192,255}:Pixel{255,192,192}); |
|
|
|
|