Verse Library verse

25 Linking Everything Together

Cleans up camera modes, sequences, and input bindings when a player exits a chair.

extracted-snippets/documentation/en-us/uefn/verse-stand-up-template-in-unreal-editor-for-fortnite/25-linking-everything-together.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/verse-stand-up-template-in-unreal-editor-for-fortnite
# Local doc:  epic-docs/documentation/en-us/uefn/verse-stand-up-template-in-unreal-editor-for-fortnite.md
# Section:    Linking Everything Together
 # Handles the player leaving the chair and removing access to the input triggers that are available while in the chair.
 OnChairExited(Agent:agent):void =
     Logger.Print("Player got up")

     # Stop the TV camera view when we leave the chair if it is active.
     if (InTVMode = true):
         TVModeSequence.Stop(Agent)
         set InTVMode = false

     # Stop the camera sequence we were using if it is active when we leave the chair.
     if (TempSeq := CurrentSequence?):
         TempSeq.Stop(Agent)

     # Clear whatever the current sequence was when we leave the chair.
     set CurrentSequence = false

     # Cancel all of our subscriptions when we leave the chair.
     CancelSubscription(ReturnToFreeLookSubscription)
     CancelSubscription(NextCameraSubscription)        
     CancelSubscription(PrevCameraSubscription)
     CancelSubscription(ReturnToTVModeSubscription)
     CancelSubscription(ChairExitSubscription)

     # Unregister us from all the input triggers when we leave the chair.
     ReturnToFreeLook.Unregister(Agent)
     NextCamera.Unregister(Agent)
     PreviousCamera.Unregister(Agent)

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