class Countdown : ActionRole() { @Attribute( about="The time in seconds to complete this scene" ) var seconds = 30 override fun activated() { updateText() } fun go() { replaceAction( ( Delay(1.0) thenOnce this:>countdown ).repeat(seconds) thenOnce Play.instance:>timeIsUp ) } fun stop() { replaceAction(null) } fun countdown() { seconds-- updateText() } fun updateText() { actor.textAppearance.text = DollsHouseProducer.timeString(seconds) } }