Population, resource and improvement images are faded out when a military unit is selected

This commit is contained in:
Yair Morgenstern 2018-11-13 21:37:41 +02:00
parent 2b2f8affd8
commit c0f2e7ab07
2 changed files with 12 additions and 2 deletions

View file

@ -21,8 +21,8 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
protected var terrainFeatureImage: Image? = null
protected var cityImage: Image? = null
protected var resourceImage: Actor? = null
protected var improvementImage: Actor? = null
var resourceImage: Actor? = null
var improvementImage: Actor? = null
var populationImage: Image? = null
private val roadImages = HashMap<TileInfo, RoadImage>()
private val borderImages = HashMap<TileInfo, List<Image>>() // map of neighboring tile to border images

View file

@ -170,6 +170,16 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
tileGroups[tile]!!.showCrosshair()
}
}
val fadeout = if(unit.baseUnit.unitType.isCivilian()) 1f
else 0.5f
for(tile in tileGroups.values){
if(tile.populationImage!=null) tile.populationImage!!.color.a=fadeout
if(tile.improvementImage!=null) tile.improvementImage!!.color.a=fadeout
if(tile.resourceImage!=null) tile.resourceImage!!.color.a=fadeout
}
}
else if(overlayActor!=null){
overlayActor!!.remove()