32 lines
758 B
GDScript
32 lines
758 B
GDScript
class_name EntityInteractableArea extends Area3D
|
|
const Entity = preload("res://overworld/entity/Entity.gd")
|
|
|
|
@export var entity:Entity
|
|
|
|
func isInteractable() -> bool:
|
|
if !entity:
|
|
return false
|
|
|
|
if entity.interactType == Entity.InteractType.NONE:
|
|
return false
|
|
|
|
if entity.interactType == Entity.InteractType.CONVERSATION:
|
|
if entity.conversation.size() == 0:
|
|
return false
|
|
|
|
return true
|
|
|
|
func _onConversationInteract(_other:Entity) -> void:
|
|
CUTSCENE.setConversation(entity.conversation)
|
|
|
|
func onInteract(other:Entity) -> void:
|
|
if entity.interactType == Entity.InteractType.NONE:
|
|
return
|
|
|
|
match entity.interactType:
|
|
Entity.InteractType.CONVERSATION:
|
|
_onConversationInteract(other)
|
|
return
|
|
_:
|
|
pass
|