이 단계에서는 플레이어가 맞힐 경우 추가 시간을 부여하는 특별한 타깃을 만들게 됩니다. 타깃은 양수 점수를 제공하는 타깃 적중 시 랜덤하게 올라오며, 나타날 때까지 타깃이 올라올 확률은 증가합니다.
섬 수정하기
뷰포트에서 콤보 타깃(Combo Target)을 선택합니다.
Alt 키를 누르고 축 위젯을 좌클릭한 뒤 중복 타깃을 사격 갤러리 앞쪽으로 드래그합니다. 이것이 추가 시간 타깃이 됩니다.
디테일(Details) 패널에서 TargetType을 절친 이모트(Dancing)로 설정합니다.
Verse 코드 작성
이 페이지에서는 코드 변경을 단계별로 상세히 안내하지만, 작업물을 확인하고 싶다면 완성된 코드 섹션에서 최종 결과를 검토하세요.
Shooting_range_manager_device.verse파일을 엽니다.다음 라이브러리를 추가해 랜덤 번호 생성을 지원합니다.
Verseusing { /Verse.org/Random }다음 변수를 추가해 타깃 장치 레퍼런스와 관련 프로퍼티를 저장합니다. 지속 시간과 보상 변수는 초 단위입니다.
Verse@editable InitialTimerDuration:float = 30.0 @editable MaxTimerDuration:float = 60.0 @editable BonusTimeTarget:shooting_range_target_track_device = shooting_range_target_track_device{} @editable타이머를 증가시키는
OnBonusTimeTargetHit콜백 메서드를 추가합니다.Verse# A hit callback that adds bonus time and disables the BonusTimeTarget. OnBonusTimeTargetHit():void= CurrentDuration:float = Timer.GetActiveDuration() Timer.SetActiveDuration(CurrentDuration + BonusTimeReward) BonusTimeTarget.PopDown() BonusTimeTarget.Disable()OnBegin메서드를 수정해 추가 시간 타깃 이벤트 구독을 설정하고 비활성화합니다.Verse# Runs when the device is started in a running game. OnBegin<override>()<suspends>:void= # Subscribing to the GoodTarget HitEvents. GoodTarget1.HitEvent.Subscribe(OnGoodTarget1Hit) GoodTarget2.HitEvent.Subscribe(OnGoodTarget2Hit) GoodTarget3.HitEvent.Subscribe(OnGoodTarget3Hit) # Subscribing to the BadTarget HitEvents. BadTarget1.HitEvent.Subscribe(OnBadTarget1Hit) BadTarget2.HitEvent.Subscribe(OnBadTarget2Hit)StartTimer메서드를 수정해 타이머의 최대 및 활성 지속 시간을 설정합니다.Verse# Setup and start the timer. StartTimer():void= # Set the event subscription to call OnTimerSuccess when the timer finishes. Timer.SuccessEvent.Subscribe(OnTimerSuccess) <# --- New Code Start --- #> # Set the max and active duration based on the set property values. Timer.SetMaxDuration(MaxTimerDuration) Timer.SetActiveDuration(InitialTimerDuration)AdjustScore메서드를 수정해 적중한 좋은 타깃 개수에 따라 추가 시간 타깃이 랜덤하게 나타나게 합니다.Verse# Adjusts the player's score by the provided value. AdjustScore(Value:int):void= # Start the timer if it hasn't started yet. if (not IsTimerStarted?): StartTimer() # Sets the score award to the base value of the target. ScoreManager.SetScoreAward(Value) # Gets the first player in the playspace.Verse 코드를 저장 및 빌드합니다.
완성된 코드
using { /Fortnite.com/Devices }
using { /Verse.org/Random }
using { /Verse.org/Simulation }
# A device that manages shooting range gameplay.
shooting_range_manager_device := class(creative_device):
@editable
ScoreManager:score_manager_device = score_manager_device{}
모두 합치기
뷰포트 또는 아웃라이너(Outliner) 패널에서 shooting_range_manager_device를 선택합니다.
디테일 패널에서 추가 시간 타깃에 BonusTimeTarget을 설정합니다.
변경 사항을 푸시하고 섬을 플레이테스트합니다.
추가 시간 타깃이 양수 득점 타깃에 사격 후 때때로 등장하는지 검증합니다.