Added Interact system with a raycast

This commit is contained in:
2024-06-03 23:39:36 -05:00
parent 1003bc186e
commit 9f76eacaad
5 changed files with 122 additions and 4 deletions

View File

@ -1,8 +1,11 @@
[gd_scene load_steps=5 format=3 uid="uid://bcjijcf8br8t4"]
[gd_scene load_steps=8 format=3 uid="uid://bcjijcf8br8t4"]
[ext_resource type="Script" path="res://Assets/scripts/player.gd" id="1_b2ij4"]
[ext_resource type="Script" path="res://Assets/scripts/Head.gd" id="2_is0vo"]
[ext_resource type="Script" path="res://Assets/scripts/vapelight.gd" id="2_ndvgb"]
[ext_resource type="Script" path="res://Assets/scripts/InteractRay.gd" id="4_x7epo"]
[ext_resource type="Texture2D" uid="uid://c786idyo8hs4l" path="res://Assets/textures/Crosshair.png" id="5_4upch"]
[ext_resource type="Theme" uid="uid://dx4a66pg3q8cy" path="res://Assets/Resources/UI_Theme.tres" id="5_qcry7"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_lm3xc"]
@ -30,6 +33,40 @@ spot_angle = 62.91
spot_angle_attenuation = 1.38495
script = ExtResource("2_ndvgb")
[node name="RayCast3D" type="RayCast3D" parent="Head"]
target_position = Vector3(0, 0, -4)
script = ExtResource("4_x7epo")
[node name="Prompt" type="Label" parent="Head/RayCast3D"]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -39.0
offset_top = 14.0
offset_right = 40.0
offset_bottom = 30.0
grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("5_qcry7")
text = "Press E"
[node name="Crosshair" type="TextureRect" parent="Head"]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -10.0
offset_top = -10.0
offset_right = 10.0
offset_bottom = 10.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("5_4upch")
stretch_mode = 2
[node name="Severe Coughing Timer" type="Timer" parent="."]
wait_time = 10.0