using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # LIGHTS, CAMERA, VERSE — play a cinematic sequence from code. # # A Cinematic Sequence device wraps a Level Sequence you author in Sequencer: # moving cameras, animated doors, lights flaring, a boss rising from the floor. # Verse doesn't author the keyframes — it drives the TRANSPORT: roll it forward, # roll it back, stop it, and react the instant it finishes. # # This device gives players a "play" button and a "rewind" button for a sequence, # and uses StoppedEvent to do something the moment the show is over (here: open a # door). The Cinematic Sequence device must be set to *Everyone* for the no-agent # Play()/PlayReverse() calls used below. cine_player_device := class(creative_device): # The Level Sequence to drive. Author it in Sequencer, then drop it here. @editable Cine : cinematic_sequence_device = cinematic_sequence_device{} # Rolls the sequence forward. @editable PlayButton : button_device = button_device{} # Rolls the sequence backward (a clean rewind, no editor work needed). @editable RewindButton : button_device = button_device{} # Plays a fanfare when the sequence finishes — the payoff of the cinematic. # (An Audio Player set to "Heard by Everyone" so the no-agent Play() works.) @editable Fanfare : audio_player_device = audio_player_device{} OnBegin() : void = PlayButton.InteractedWithEvent.Subscribe(OnPlay) RewindButton.InteractedWithEvent.Subscribe(OnRewind) # StoppedEvent fires whenever the sequence stops — naturally at the end, # or because someone called Stop()/GoToEndAndStop(). It carries no data # (an empty tuple), so the handler takes no parameters. Cine.StoppedEvent.Subscribe(OnSequenceStopped) OnPlay(Presser : agent) : void = Print("Cinematic: rolling forward") Cine.Play() OnRewind(Presser : agent) : void = Print("Cinematic: rewinding") Cine.PlayReverse() # The payoff. Because StoppedEvent fires on EVERY stop, we sound the fanfare # whenever the show ends — the cinematic "earns" the reward. OnSequenceStopped() : void = Print("Cinematic finished — sounding the fanfare") Fanfare.Play()