lul
This commit is contained in:
38
Assets/lua/door.lua
Normal file
38
Assets/lua/door.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
-- ============================================================================
|
||||
-- door.lua - Interactable door that plays an open cutscene
|
||||
-- ============================================================================
|
||||
-- Tests: onInteract, Cutscene.Play with onComplete, Entity.Find,
|
||||
-- Entity.SetActive, Controls, Audio
|
||||
|
||||
local isOpen = false
|
||||
|
||||
function onCreate(self)
|
||||
isOpen = false
|
||||
Debug.Log("Door created")
|
||||
end
|
||||
|
||||
function onInteract(self)
|
||||
if isOpen then
|
||||
setStatus("Door is already open")
|
||||
return
|
||||
end
|
||||
if Cutscene.IsPlaying() then return end
|
||||
|
||||
isOpen = true
|
||||
Audio.Play("door_open", 100, 64)
|
||||
Controls.SetEnabled(false)
|
||||
setStatus("Opening door...")
|
||||
|
||||
Cutscene.Play("door_open", {
|
||||
onComplete = function()
|
||||
Controls.SetEnabled(true)
|
||||
setStatus("Door opened! Path is clear.")
|
||||
|
||||
-- Disable the door blocker object
|
||||
local blocker = Entity.Find("DoorBlocker")
|
||||
if blocker then
|
||||
Entity.SetActive(blocker, false)
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
Reference in New Issue
Block a user