using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
collect_coin_device := class(creative_device):
@editable
CollectibleObjectDevices:[]collectible_object_device = array{}
@editable
ButtonDevice:button_device = button_device{}
@editable
BarrierDevice:barrier_device = barrier_device{}
@editable
HUDMessageDevice:hud_message_device = hud_message_device{}
var CollectCount:int = 0
OnBegin<override>()<suspends>:void=
for(CollectibleObject : CollectibleObjectDevices):
CollectibleObject.CollectedEvent.Subscribe(OnCollect)
ButtonDevice.InteractedWithEvent.Subscribe(OnInteract)
OnCollect(Agent:agent):void=
set CollectCount += 1
OnInteract(Agent:agent):void=
if(CollectCount >= 3):
BarrierDevice.Disable()
else:
HUDMessageDevice.Show()