using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # THE GRAND REVEAL — orchestrate a sequenced show from Verse. # # This capstone ties the whole domain together. One Button kicks off a timed, # multi-beat performance that the THREE animation surfaces you've met take turns # driving: # # beat 1 Cinematic Sequence — a camera flythrough rolls (Part 2 + Part 3) # beat 2 Animated Mesh — a skeletal performer animates (Part 1) # beat 3 Character device — the host mannequin emotes (PlayEmote) # finale Audio Player — a fanfare, then the rate is reset for next time # # The magic is the orchestration. OnGo can't wait (it must return immediately), # so it `spawn`s a coroutine, RunReveal, which runs the beats IN ORDER: # it uses StoppedEvent.Await() to block until the cinematic actually finishes, and # Sleep() to hold each later beat for a set time. That's how you choreograph # animations across devices on a single shared timeline. # # A guard (var Running) stops a second press from starting an overlapping show. # The Cinematic Sequence device should be set to *Everyone* (or pass the agent on # every call). Here we pass the instigating agent so it works in either mode. grand_reveal_device := class(creative_device): @editable StartButton : button_device = button_device{} @editable Cine : cinematic_sequence_device = cinematic_sequence_device{} @editable Performer : animated_mesh_device = animated_mesh_device{} @editable Host : character_device = character_device{} @editable Fanfare : audio_player_device = audio_player_device{} # How long (seconds) to let the skeletal performer animate in beat 2. @editable PerformerSeconds : float = 3.0 # True while a reveal is playing, so a second press is ignored. var Running : logic = false OnBegin() : void = StartButton.InteractedWithEvent.Subscribe(OnGo) # Event handlers can't suspend, so we launch the show as a coroutine. OnGo(Presser : agent) : void = if (not Running?): spawn { RunReveal(Presser) } # The choreography, beat by beat, on one shared timeline. RunReveal(Agent : agent) : void = set Running = true # BEAT 1 — the camera flythrough. Reset to the top, normal speed, roll, # then WAIT right here until StoppedEvent fires (the sequence finished). Cine.SetPlaybackTime(0.0) Cine.SetPlayRate(1.0) Print("Reveal beat 1: cinematic flythrough") Cine.Play(Agent) Cine.StoppedEvent.Await() # BEAT 2 — the skeletal performer animates for a set time. Print("Reveal beat 2: skeletal performer") Performer.Play() Sleep(PerformerSeconds) Performer.Pause() # BEAT 3 — the host bows / emotes. Print("Reveal beat 3: host emote") Host.PlayEmote() Sleep(1.5) # FINALE — fanfare, and re-arm for the next show. Fanfare.Play() Print("Reveal complete") set Running = false