28 lines
849 B
GDScript
28 lines
849 B
GDScript
##TODO Add something to determine what character the script is attached to for proper dialogue
|
|
extends CharacterBody3D
|
|
|
|
@onready var player_ray: RayCast3D = get_tree().get_first_node_in_group("player_ray")
|
|
var dialogue
|
|
|
|
var mood: float = 5
|
|
|
|
func _ready() -> void:
|
|
## Load in the correct dialogue tree for the character
|
|
dialogue = load("res://dialogue/" + self.name.to_lower() + ".dialogue")
|
|
|
|
func _physics_process(_delta: float) -> void:
|
|
if has_node("InteractLabel"):
|
|
if player_ray.is_colliding() and player_ray.get_collider() == $".":
|
|
$InteractLabel.show()
|
|
else:
|
|
$InteractLabel.hide()
|
|
|
|
func interact():
|
|
if Global.dialogue_wait == false:
|
|
DialogueManager.show_dialogue_balloon(dialogue, "start")
|
|
print("res://dialogue/" + self.name + ".dialogue")
|
|
|
|
func affinity(mood_swing):
|
|
mood += mood_swing
|
|
print("mariana mood: " + str(mood))
|