# Source URL: https://dev.epicgames.com/documentation/fortnite/verse-start-05-refactor-and-refine-in-fortnite
# Local doc: epic-docs/documentation/fortnite/verse-start-05-refactor-and-refine-in-fortnite.md
# Section: Complete Code
using { /Fortnite.com/Devices }
using { /Verse.org/Random }
using { /Verse.org/Simulation }
<#>
Utility Classes
<#>
# A wrapper class for the good targets to support array storage with a self-contained event callback.
good_target_wrapper := class:
@editable
Target:shooting_range_target_track_device = shooting_range_target_track_device{}
@editable
Score:int = 100
# A circular reference to the shooting range manager device.
var RangeManager:shooting_range_manager_device= shooting_range_manager_device{}
# Tracks if this target is hit to support combo functionality.
var IsHit:logic = false
# Initializes the target's manager reference and event subscription.
Init(Manager:shooting_range_manager_device):void=
set RangeManager = Manager
Target.HitEvent.Subscribe(OnHit)
# A hit callback that updates the hit state, scores the target, and checks the combo.
OnHit():void=
if (not IsHit?):
set IsHit = true
Target.Disable()
RangeManager.AdjustScore(Score)
RangeManager.CheckCombo()
Verse Library
verse
09 Complete Code
Defines wrapper classes that encapsulate target data, hit events, and manager references for shooting range logic.
extracted-snippets/documentation/fortnite/verse-start-05-refactor-and-refine-in-fortnite/09-complete-code.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.