# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/pizza-pursuit-2-defining-the-pickup-and-delivery-zones-for-time-trial-in-verse
# Local doc: epic-docs/documentation/en-us/fortnite/pizza-pursuit-2-defining-the-pickup-and-delivery-zones-for-time-trial-in-verse.md
# Section: Using Abstraction for Creating a Zone Class
# A zone is an area of the map (represented by a device) that can be Activated/Deactivated and that provides events to signal when the zone has been "Completed" (can't be completed anymore until next activation).
# Zone "Completed" depends on the device type (ActivatorDevice) for the zone.
# Suggested usage: ActivateZone() -> ZoneCompletedEvent.Await() -> DeactivateZone() #
base_zone<public> := class:
ActivatorDevice<public> : creative_object_interface
ZoneCompletedEvent<public> : event(base_zone) = event(base_zone){}
GetTransform<public>() : transform =
ActivatorDevice.GetTransform()
# Activates the Zone.
# You should enable devices and any visual indicators for the zone here.
ActivateZone<public>() : void =
# The base zone can handle zones defined as item spawners or capture areas.
# Try and cast to each type to see which we're dealing with.
if (CaptureArea := capture_area_device[ActivatorDevice]):
CaptureArea.Enable()
spawn { WaitForZoneCompleted(option{CaptureArea.AgentEntersEvent}) }
else if (ItemSpawner := item_spawner_device[ActivatorDevice]):
ItemSpawner.Enable()
spawn { WaitForZoneCompleted(option{ItemSpawner.ItemPickedUpEvent}) }
# Deactivates the Zone.
# You should disable devices and any visual indicators for the zone here.
DeactivateZone<public>() : void =
if (CaptureArea := capture_area_device[ActivatorDevice]):
CaptureArea.Disable()
else if (ItemSpawner := item_spawner_device[ActivatorDevice]):
ItemSpawner.Disable()
ZoneDeactivatedEvent.Signal()
Verse Library
verse
08 Using Abstraction For Creating A Zone Class
Defines a reusable zone class that activates devices, waits for completion events, and handles deactivation.
extracted-snippets/documentation/en-us/fortnite/pizza-pursuit-2-defining-the-pickup-and-delivery-zones-for-time-trial-in-verse/08-using-abstraction-for-creating-a-zone-class.verse
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.