いろいろな型のいろいろなeditable

要件

  1. 以下のeditableを用意する
    • LimitCount: int型
    • LaunchText: string型
    • IsLimited: logic型
  2. クラッシュパッドの仕掛けを設置する
  3. クラッシュパッドを踏むと「LaunchText」のログを表示する
  4. IsLimitedがtrueの場合は踏んだ回数を記録する
  5. もしIsLimitedがtrueかつLimitCountに踏んだ回数が達した場合、クラッシュパッドを無効にする

必要なモノ

  1. クラッシュパッドの仕掛け(x1)
  2. Print関数

回答

回答を見る
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

limited_crash_pad_device := class(creative_device):
    @editable
    LimitCount:int = 3
    @editable
    LaunchText:string = "Hello"
    @editable
    IsLimited:logic = true

    @editable
    CrashPadDevice:crash_pad_device = crash_pad_device{}

    var LaunchCount:int = 0

    OnBegin<override>()<suspends>:void=
        CrashPadDevice.LaunchedEvent.Subscribe(OnLaunch)

    OnLaunch(Agent:agent):void=
        Print(LaunchText)
        if(IsLimited?):
            set LaunchCount += 1
            if(LaunchCount >= LimitCount):
                CrashPadDevice.Disable()