door and interactable objects
parent
79d0f07c99
commit
53a21be4ca
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
class_name DesctructableObject extends Item
|
||||
class_name DesctructableItem extends Item
|
||||
|
||||
@onready var particles: GPUParticles3D = $Particles
|
||||
@onready var mesh: MeshInstance3D = $Mesh
|
||||
@ -0,0 +1,24 @@
|
||||
class_name InteractableItem extends Item
|
||||
|
||||
@onready var interaction_area: InteractionArea = $InteractionArea
|
||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||
|
||||
#func _ready() -> void:
|
||||
#state_changed.connect(Callable(self, "_on_state_changed"))
|
||||
#interaction_area.interact = Callable(self, "_on_interact")
|
||||
|
||||
#func _on_interact() -> void:
|
||||
#match state:
|
||||
#States.closed:
|
||||
#state = States.opened
|
||||
#interaction_area.action_name = "open"
|
||||
#States.opened:
|
||||
#state = States.closed
|
||||
#interaction_area.action_name = "close"
|
||||
#
|
||||
#func _on_state_changed(new_state: States) -> void:
|
||||
#match new_state:
|
||||
#States.opened:
|
||||
#animation_player.play("open")
|
||||
#States.closed:
|
||||
#animation_player.play("close")
|
||||
@ -0,0 +1,20 @@
|
||||
class_name WallDoorway extends InteractableItem
|
||||
|
||||
func _ready() -> void:
|
||||
state_changed.connect(_on_state_changed)
|
||||
interaction_area.interact = Callable(self, "_on_interact")
|
||||
state = States.closed
|
||||
|
||||
func _on_interact() -> void:
|
||||
match state:
|
||||
States.closed:
|
||||
animation_player.play("open")
|
||||
States.closed:
|
||||
animation_player.play("close")
|
||||
|
||||
func _on_state_changed(new_state: States) -> void:
|
||||
match new_state:
|
||||
States.closed:
|
||||
interaction_area.action_name = "open door"
|
||||
States.opened:
|
||||
interaction_area.action_name = "close door"
|
||||
Loading…
Reference in New Issue