Update UnitGroup.kt (#7375)

Handle unitBaseImage and actionGroup layers of unit icons properly if unit is idle
This commit is contained in:
letstalkaboutdune 2022-07-05 12:04:51 -07:00 committed by GitHub
parent 99367c2212
commit f3e043cd8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,10 +71,17 @@ class UnitGroup(val unit: MapUnit, val size: Float): Group() {
fun selectUnit() {
//Make unit icons fully opaque when units are selected
unitBaseImage.color.a = 1f
//Make unit icon background colors fully opaque when units are selected
background?.color?.a = 1f
actionGroup?.color?.a = 1f
//If unit is idle, leave unitBaseImage and actionGroup at 50% opacity when selected
if (!unit.isIdle()) {
unitBaseImage.color.a = 0.5f
actionGroup?.color?.a = 0.5f
} else { //Else set to 100% opacity when selected
unitBaseImage.color.a = 1f
actionGroup?.color?.a = 1f
}
val whiteHalo = getBackgroundImageForUnit()
val whiteHaloSize = 30f