-
Notifications
You must be signed in to change notification settings - Fork 0
/
FirstPersonDevice.verse
45 lines (35 loc) · 1.45 KB
/
FirstPersonDevice.verse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using { /Fortnite.com/Devices }
using { /Fortnite.com/UI }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/UI }
using { /UnrealEngine.com/Temporary/SpatialMath }
# A Verse-authored creative device that can be placed in a level
FirstPersonDevice := class(creative_device):
@editable
FirstPersonPropManipulator: prop_manipulator_device = prop_manipulator_device{}
@editable
FirstPersonMutatorZone: mutator_zone_device = mutator_zone_device{}
@editable
var IsFirstPersonEnabled: logic = false
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
# TODO: Replace this with your code
FirstPersonMutatorZone.AgentBeginsEmotingEvent.Subscribe(ToggleFirstPerson)
if (IsFirstPersonEnabled = true):
EnableFirstPerson()
else:
DisableFirstPerson()
ToggleFirstPerson(Agent: agent):void=
if (Player := player[Agent]):
if (IsFirstPersonEnabled = true):
DisableFirstPerson()
else:
EnableFirstPerson()
EnableFirstPerson():void=
FirstPersonPropManipulator.ShowProps()
set IsFirstPersonEnabled = true
DisableFirstPerson():void=
FirstPersonPropManipulator.HideProps()
set IsFirstPersonEnabled = false