Initial commit
This commit is contained in:
8
Player Controller/Interaction/InteractableObject.gd
Normal file
8
Player Controller/Interaction/InteractableObject.gd
Normal file
@@ -0,0 +1,8 @@
|
||||
class_name InteractableObject
|
||||
extends Node3D
|
||||
|
||||
@export var interact_prompt : String
|
||||
@export var can_interact : bool = true
|
||||
|
||||
func _interact():
|
||||
print("Override this function.")
|
||||
1
Player Controller/Interaction/InteractableObject.gd.uid
Normal file
1
Player Controller/Interaction/InteractableObject.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://mlp0il4nd2ge
|
||||
16
Player Controller/Interaction/InteractionController.gd
Normal file
16
Player Controller/Interaction/InteractionController.gd
Normal file
@@ -0,0 +1,16 @@
|
||||
extends RayCast3D
|
||||
|
||||
@onready var interact_prompt_label : Label = get_node("InteractionPrompt")
|
||||
|
||||
func _process(delta):
|
||||
var object = get_collider()
|
||||
interact_prompt_label.text = ""
|
||||
|
||||
if object and object is InteractableObject:
|
||||
if object.can_interact == false:
|
||||
return
|
||||
|
||||
interact_prompt_label.text = "[E] " + object.interact_prompt
|
||||
|
||||
if Input.is_action_just_pressed("interact"):
|
||||
object._interact()
|
||||
@@ -0,0 +1 @@
|
||||
uid://0xopmg7fmfbj
|
||||
Reference in New Issue
Block a user