Verse Library verse

02 Device

Manages a countdown timer and exposes state variables to dynamically style a HUD widget based on remaining time.

verse-library/making-an-animated-timer-in-unreal-editor-for-fortnite/02-device.verse

# Imports remain the same as the first script above.
# This version drives panic state through two editable float variables
# that the Widget Editor can bind to via View Bindings.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

PanicTimerLogic := class(creative_device):

    @editable
    TimerDevice: timer_device = timer_device{}

    # ---------------------------------------------------------------
    # These two variables are the "signal wires" going to the Widget.
    # In the Widget Editor, bind TimerText's Color alpha/tint to IsPanic
    # and bind its render scale to PanicScale using View Bindings.
    # ---------------------------------------------------------------

    # True  => widget should show Panic styling (red, big)
    # False => widget should show Calm styling  (white, normal)
    var IsPanic: logic = false

    # 1.0 = normal size, 1.5 = panic size
    var PanicScale: float = 1.0

    OnBegin<override>()<suspends>: void =
        TimerDevice.Start()
        TimerDevice.SuccessEvent.Subscribe(OnTimerEnd)
        spawn { RunUpdateLoop() }

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in