Whatever lol
This commit is contained in:
39
_archive/entity/npc/NPCInteract.gd
Normal file
39
_archive/entity/npc/NPCInteract.gd
Normal file
@@ -0,0 +1,39 @@
|
||||
@tool
|
||||
class_name NPCInteract extends Node
|
||||
|
||||
enum InteractType {
|
||||
NONE,
|
||||
TEXT,
|
||||
CUTSCENE
|
||||
}
|
||||
|
||||
@export var interactType:InteractType = InteractType.NONE
|
||||
@export var interactText:Array[String] = []
|
||||
|
||||
var interactTextIndex:int = 0
|
||||
|
||||
func onInteract(_player:Player) -> void:
|
||||
if interactType == InteractType.TEXT:
|
||||
interactTextIndex = 0
|
||||
UI.TEXTBOX.setText(interactText[interactTextIndex])
|
||||
UI.TEXTBOX.textboxClosing.connect(onTextboxClosing)
|
||||
return
|
||||
|
||||
pass
|
||||
|
||||
func onInteractable(player:Player) -> void:
|
||||
pass
|
||||
|
||||
func onNotInteractable(player:Player) -> void:
|
||||
pass
|
||||
|
||||
func _exit_tree() -> void:
|
||||
UI.TEXTBOX.textboxClosing.disconnect(onTextboxClosing)
|
||||
|
||||
func onTextboxClosing() -> void:
|
||||
interactTextIndex += 1
|
||||
if interactTextIndex < interactText.size():
|
||||
UI.TEXTBOX.setText(interactText[interactTextIndex])
|
||||
else:
|
||||
UI.TEXTBOX.textboxClosing.disconnect(onTextboxClosing)
|
||||
UI.TEXTBOX.setText("")
|
||||
Reference in New Issue
Block a user