26 lines
523 B
GDScript
Executable File
26 lines
523 B
GDScript
Executable File
class_name WaitAction
|
|
extends "res://cutscene/Action.gd"
|
|
|
|
# Properties
|
|
var duration: float # Time to wait in seconds
|
|
var elapsed_time: float = 0.0
|
|
|
|
func _init(wait_duration: float) -> void:
|
|
duration = wait_duration
|
|
name = "WaitAction"
|
|
|
|
func start() -> void:
|
|
elapsed_time = 0.0
|
|
self._set_running()
|
|
|
|
func update(delta: float) -> void:
|
|
if state != State.RUNNING:
|
|
return
|
|
|
|
elapsed_time += delta
|
|
if elapsed_time >= duration:
|
|
self._set_completed()
|
|
|
|
func is_completed() -> bool:
|
|
return state == State.COMPLETED
|