ブザーの鳴るボタン

ワークショップにて「Buzzer」で登録あり


■スクリプト内容
--最初にブザーを押した人をpritで表示するには、これをtrueに設定します。<早押し等
printFastest = false

--誰かが押した後に、もう一度ボタンを押すことができるようになるまでの遅延(ディレイ)
--0はオプションです。使うことはないでしょう。
resetDelay = 2

function onload()
    lockout = false
    self.createButton({
        label="", click_function="bzzt", function_owner=self,
        position={0,0,0}, height=350, width=350
    })
end

function bzzt(o, color)
    if lockout == false then
        lockout = true
        self.AssetBundle.playTriggerEffect(0)
        if printFastest == true then
            printToAll(Player[color].steam_name.." pressed the button.", stringColorToRGB(color))
        end
        lockoutTimer()
    end
end

function unlock()
    lockout = false
end

function lockoutTimer()
    Timer.destroy(self.getGUID())
    Timer.create({identifier=self.getGUID(), function_name='unlock', delay=resetDelay})
end

タグ:

+ タグ編集
  • タグ:
最終更新:2017年07月07日 18:45