Refactoring
This commit is contained in:
@@ -4,13 +4,29 @@ const Entity = preload("res://overworld/entity/Entity.gd")
|
||||
@export var entity:Entity
|
||||
|
||||
func isInteractable() -> bool:
|
||||
return entity && entity.interactType != Entity.InteractType.NONE
|
||||
|
||||
func onInteract() -> void:
|
||||
if !isInteractable():
|
||||
return
|
||||
if !entity:
|
||||
return false
|
||||
|
||||
if entity.interactType == Entity.InteractType.NONE:
|
||||
return
|
||||
return false
|
||||
|
||||
print("Entity Interacted")
|
||||
if entity.interactType == Entity.InteractType.CONVERSATION:
|
||||
if entity.conversation.size() == 0:
|
||||
return false
|
||||
|
||||
return true
|
||||
|
||||
func _onConversationInteract(_other:Entity) -> void:
|
||||
print("Starting conversation with ", entity.name)
|
||||
pass
|
||||
|
||||
func onInteract(other:Entity) -> void:
|
||||
if entity.interactType == Entity.InteractType.NONE:
|
||||
return
|
||||
|
||||
match entity.interactType:
|
||||
Entity.InteractType.CONVERSATION:
|
||||
_onConversationInteract(other)
|
||||
return
|
||||
_:
|
||||
pass
|
||||
Reference in New Issue
Block a user