小道具をまとめて表示/非表示

要件

  1. 小道具の配列を作成する
  2. ボタンを二つ設置する(A, B)
  3. ボタンAを押すと配列内の小道具をすべて非表示にする
  4. ボタンBを押すと配列内の小道具をすべて表示する

使用するモノ

  1. 建築小道具(好きな数)
  2. ボタンの仕掛け(x2)

回答

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

prop_array_device := class(creative_device):
    @editable
    Props:[]creative_prop = array{}
    @editable
    ShowButtonDevice:button_device = button_device{}
    @editable
    HideButtonDevice:button_device = button_device{}

    OnBegin<override>()<suspends>:void=
        ShowButtonDevice.InteractedWithEvent.Subscribe(OnInteractShow)
        HideButtonDevice.InteractedWithEvent.Subscribe(OnInteractHide)

    OnInteractShow(Agent:agent):void=
        for(Prop : Props):
            Prop.Show()

    OnInteractHide(Agent:agent):void=
        for(Prop : Props):
            Prop.Hide()