Whatever lol
This commit is contained in:
43
_archive/entity/npc/NPC.gd
Normal file
43
_archive/entity/npc/NPC.gd
Normal file
@@ -0,0 +1,43 @@
|
||||
@tool
|
||||
class_name NPC extends CharacterBody3D
|
||||
|
||||
@export var _movement:NPCMovement
|
||||
@export var _interact:NPCInteract
|
||||
|
||||
# NPC Movement Accessors
|
||||
@export var walkSpeed:float:
|
||||
set(value):
|
||||
if _movement:
|
||||
_movement.walkSpeed = value
|
||||
get:
|
||||
if _movement:
|
||||
return _movement.walkSpeed
|
||||
return 0
|
||||
|
||||
@export var runSpeed:float:
|
||||
set(value):
|
||||
if _movement:
|
||||
_movement.runSpeed = value
|
||||
get:
|
||||
if _movement:
|
||||
return _movement.runSpeed
|
||||
return 0
|
||||
|
||||
# NPC Interact Accessors
|
||||
@export var interactType:NPCInteract.InteractType:
|
||||
set(value):
|
||||
if _interact:
|
||||
_interact.interactType = value
|
||||
get:
|
||||
if _interact:
|
||||
return _interact.interactType
|
||||
return NPCInteract.InteractType.NONE
|
||||
|
||||
@export var interactText:String:
|
||||
set(value):
|
||||
if _interact:
|
||||
_interact.interactText = value
|
||||
get:
|
||||
if _interact:
|
||||
return _interact.interactText
|
||||
return ""
|
||||
1
_archive/entity/npc/NPC.gd.uid
Normal file
1
_archive/entity/npc/NPC.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://crw7ls7t8cwct
|
||||
56
_archive/entity/npc/NPC.tscn
Normal file
56
_archive/entity/npc/NPC.tscn
Normal file
@@ -0,0 +1,56 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://kabs7mopalmo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://crw7ls7t8cwct" path="res://entity/npc/NPC.gd" id="1_00k55"]
|
||||
[ext_resource type="Script" uid="uid://b00rxpveu3v4m" path="res://InteractableArea.gd" id="2_x8luf"]
|
||||
[ext_resource type="Script" uid="uid://tlfthv88ki0y" path="res://entity/npc/NPCMovement.gd" id="3_1seh5"]
|
||||
[ext_resource type="Script" uid="uid://dunhfgdwp8wjh" path="res://entity/npc/NPCInteract.gd" id="3_binvk"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_jphom"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_jphom"]
|
||||
size = Vector3(1, 2, 1)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jphom"]
|
||||
shading_mode = 0
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_jphom"]
|
||||
material = SubResource("StandardMaterial3D_jphom")
|
||||
|
||||
[node name="NPC" type="CharacterBody3D" node_paths=PackedStringArray("_movement", "_interact")]
|
||||
script = ExtResource("1_00k55")
|
||||
_movement = NodePath("Scripts/NPCMovement")
|
||||
_interact = NodePath("Scripts/NPCInteract")
|
||||
walkSpeed = 8.0
|
||||
runSpeed = 12.0
|
||||
|
||||
[node name="Scripts" type="Node" parent="."]
|
||||
|
||||
[node name="NPCMovement" type="Node" parent="Scripts" node_paths=PackedStringArray("body")]
|
||||
script = ExtResource("3_1seh5")
|
||||
body = NodePath("../..")
|
||||
|
||||
[node name="NPCInteract" type="Node" parent="Scripts"]
|
||||
script = ExtResource("3_binvk")
|
||||
interactText = ""
|
||||
metadata/_custom_type_script = "uid://dunhfgdwp8wjh"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("CapsuleShape3D_jphom")
|
||||
|
||||
[node name="Rotate" type="Node3D" parent="."]
|
||||
|
||||
[node name="InteractableArea" type="Area3D" parent="Rotate"]
|
||||
script = ExtResource("2_x8luf")
|
||||
metadata/_custom_type_script = "uid://b00rxpveu3v4m"
|
||||
|
||||
[node name="InteractableShape" type="CollisionShape3D" parent="Rotate/InteractableArea"]
|
||||
transform = Transform3D(0.999999, -0.000856732, 0.0007724, 0.000857588, 0.999999, -0.00114162, -0.000771449, 0.00114226, 0.999999, 0, 0, 0)
|
||||
shape = SubResource("BoxShape3D_jphom")
|
||||
|
||||
[node name="CapsuleMesh" type="MeshInstance3D" parent="Rotate"]
|
||||
mesh = SubResource("CapsuleMesh_jphom")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[connection signal="interactEvent" from="Rotate/InteractableArea" to="Scripts/NPCInteract" method="onInteract"]
|
||||
[connection signal="interactable" from="Rotate/InteractableArea" to="Scripts/NPCInteract" method="onInteractable"]
|
||||
[connection signal="notInteractable" from="Rotate/InteractableArea" to="Scripts/NPCInteract" method="onNotInteractable"]
|
||||
1
_archive/entity/npc/NPCForwarder.gd.uid
Normal file
1
_archive/entity/npc/NPCForwarder.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dda6r22r8eow2
|
||||
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("")
|
||||
1
_archive/entity/npc/NPCInteract.gd.uid
Normal file
1
_archive/entity/npc/NPCInteract.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dunhfgdwp8wjh
|
||||
2
_archive/entity/npc/NPCMovement.gd
Normal file
2
_archive/entity/npc/NPCMovement.gd
Normal file
@@ -0,0 +1,2 @@
|
||||
# @tool
|
||||
# class_name NPCMovement extends "res://entity/EntityMovement.gd"
|
||||
1
_archive/entity/npc/NPCMovement.gd.uid
Normal file
1
_archive/entity/npc/NPCMovement.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://tlfthv88ki0y
|
||||
5
_archive/entity/npc/NPCTest.gd
Normal file
5
_archive/entity/npc/NPCTest.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
class_name NPCTest extends Node
|
||||
|
||||
func onInteract(playerEntity: Player) -> void:
|
||||
print("Player has interacted with the NPC.")
|
||||
UI.TEXTBOX.setText("You have interacted with the NPC.")
|
||||
1
_archive/entity/npc/NPCTest.gd.uid
Normal file
1
_archive/entity/npc/NPCTest.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cmwovncvo1n5o
|
||||
Reference in New Issue
Block a user