fix: multimeter's block cursor would break fixture ghost

This commit is contained in:
minjaesong
2024-03-19 04:55:37 +09:00
parent f696a54d2d
commit b856574d20
5 changed files with 23 additions and 7 deletions

View File

@@ -25,7 +25,7 @@ import kotlin.math.floor
class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = PhysProperties.MOBILE_OBJECT()), NoSerialise {
enum class MarkerMode {
FIXTURE_GHOST, BLOCK_MARKER
FIXTURE_GHOST, BLOCK_MARKER, HIDDEN
}
private val defaultSize = 16.0
@@ -45,12 +45,14 @@ class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = Phy
init {
this.isVisible = false
this.isVisible = true
renderOrder = Actor.RenderOrder.OVERLAY // for some reason the constructor didn't work
}
override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
this.isVisible = true
if (isVisible) {
if (markerMode == MarkerMode.FIXTURE_GHOST) {
if (INGAME.actorNowPlaying != null) {
@@ -114,6 +116,16 @@ class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = Phy
ghost = null
setGhostColourNone()
hitbox.setDimension(TILE_SIZED, TILE_SIZED)
markerMode = MarkerMode.HIDDEN
}
fun hideMarker() {
unsetGhost()
}
fun showMarker(shape: Int) {
markerShape = shape
markerMode = MarkerMode.BLOCK_MARKER
}
fun setGhostColourNone() { ghostColour = Color.WHITE }