mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Added crosshair image on attackable enemies
This commit is contained in:
parent
39cd9c9fa7
commit
4f727df216
BIN
android/assets/OtherIcons/Crosshair.png
Normal file
BIN
android/assets/OtherIcons/Crosshair.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
@ -40,7 +40,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
val isOwnedByEnemy = neighborOwner!=null && neighborOwner!=unit.civInfo
|
||||
if ((isOwnedByEnemy && neighbor.isCityCenter())// Enemy city,
|
||||
|| (neighbor.getUnits().isNotEmpty() && neighbor.getUnits().first().civInfo!=unit.civInfo) // Enemy unit
|
||||
|| (isOwnedByEnemy && !unit.civInfo.canEnterTiles(neighborOwner!!))
|
||||
|| (isOwnedByEnemy && !unit.civInfo.canEnterTiles(neighborOwner!!)) // enemyTile
|
||||
)
|
||||
totalDistanceToTile = unitMovement // Can't go here.
|
||||
// The reason that we don't just "return" is so that when calculating how to reach an enemy,
|
||||
|
@ -27,6 +27,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
protected var civilianUnitImage: Group? = null
|
||||
protected var militaryUnitImage: Group? = null
|
||||
private val circleImage = ImageGetter.getImage("OtherIcons/Circle.png") // for blue and red circles on the tile
|
||||
private val crosshairImage = ImageGetter.getImage("OtherIcons/Crosshair.png") // for blue and red circles on the tile
|
||||
private val fogImage = ImageGetter.getImage("TerrainIcons/Fog.png")
|
||||
var yieldGroup = YieldGroup()
|
||||
|
||||
@ -41,6 +42,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
addHexagon(groupSize)
|
||||
addCircleImage()
|
||||
addFogImage()
|
||||
addCrosshairImage()
|
||||
}
|
||||
|
||||
private fun addCircleImage() {
|
||||
@ -59,6 +61,19 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
addActor(fogImage)
|
||||
}
|
||||
|
||||
private fun addCrosshairImage(){
|
||||
crosshairImage.width=70f
|
||||
crosshairImage.height=70f
|
||||
crosshairImage.center(this)
|
||||
crosshairImage.isVisible=false
|
||||
crosshairImage.color= Color.WHITE.cpy().apply { a=0.5f }
|
||||
addActor(crosshairImage)
|
||||
}
|
||||
|
||||
fun showCrosshair(){
|
||||
crosshairImage.isVisible=true
|
||||
}
|
||||
|
||||
private fun addHexagon(groupSize: Float) {
|
||||
val imageScale = groupSize * 1.5f / hexagon.width
|
||||
hexagon.setScale(imageScale)
|
||||
@ -107,6 +122,9 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
updateRoadImages()
|
||||
updateBorderImages()
|
||||
|
||||
crosshairImage.toFront()
|
||||
crosshairImage.isVisible=false
|
||||
|
||||
fogImage.toFront()
|
||||
fogImage.isVisible=!(isViewable || UnCivGame.Current.viewEntireMapForDebug)
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
||||
if((playerViewableTiles.contains(WG.tileInfo) || UnCivGame.Current.viewEntireMapForDebug)
|
||||
&& unitsInTile.isNotEmpty() && unitsInTile.first().civInfo!=civInfo)
|
||||
WG.showCircle(Color.RED)
|
||||
} // Display ALL viewable enemies ewith a red circle so that users don't need to go "hunting" for enemy units
|
||||
} // Display ALL viewable enemies with a red circle so that users don't need to go "hunting" for enemy units
|
||||
|
||||
if(worldScreen.bottomBar.unitTable.selectedUnit!=null){
|
||||
val unit = worldScreen.bottomBar.unitTable.selectedUnit!!
|
||||
@ -118,7 +118,10 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
|
||||
&& it.getUnits().first().owner != unit.owner
|
||||
&& (playerViewableTiles.contains(it) || UnCivGame.Current.viewEntireMapForDebug)}) {
|
||||
if(unit.getBaseUnit().unitType== UnitType.Civilian) tileGroups[tile]!!.hideCircle()
|
||||
else tileGroups[tile]!!.showCircle(colorFromRGB(237, 41, 57))
|
||||
else {
|
||||
tileGroups[tile]!!.showCircle(colorFromRGB(237, 41, 57))
|
||||
tileGroups[tile]!!.showCrosshair()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user