gd: added wall hugging

This commit is contained in:
2025-06-10 11:46:51 +02:00
parent 141688ef32
commit 0c015750fd
5 changed files with 135 additions and 28 deletions

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=34 format=3 uid="uid://bei4nhkf8lwdo"]
[gd_scene load_steps=35 format=3 uid="uid://bei4nhkf8lwdo"]
[ext_resource type="Script" uid="uid://bbbrf5ckydfna" path="res://player_controller/Scripts/PlayerController.cs" id="1_poq2x"]
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://systems/inputs/base_mode/base_mode.tres" id="3_cresl"]
@ -29,6 +29,7 @@
[ext_resource type="Script" uid="uid://jk2jm1g6q853" path="res://addons/godot_state_charts/compound_state.gd" id="26_infe6"]
[ext_resource type="Script" uid="uid://cytafq8i1y8qm" path="res://addons/godot_state_charts/atomic_state.gd" id="27_34snm"]
[ext_resource type="Script" uid="uid://c1vp0ojjvaby1" path="res://addons/godot_state_charts/parallel_state.gd" id="27_infe6"]
[ext_resource type="Script" uid="uid://tjiji63wlom5" path="res://systems/wall_hug/WallHugSystem.cs" id="27_n7qhm"]
[ext_resource type="Script" uid="uid://cf1nsco3w0mf6" path="res://addons/godot_state_charts/transition.gd" id="28_n7qhm"]
[ext_resource type="PackedScene" uid="uid://ckm3d6k08a72u" path="res://systems/weapon/weapon.tscn" id="29_wv70j"]
@ -141,6 +142,26 @@ StraightThrowDuration = 0.07
[node name="CoyoteTime" type="Timer" parent="."]
wait_time = 0.2
[node name="WallHugSystem" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
script = ExtResource("27_n7qhm")
[node name="back" type="RayCast3D" parent="WallHugSystem"]
target_position = Vector3(0, 0, 1)
collision_mask = 2
[node name="front" type="RayCast3D" parent="WallHugSystem"]
target_position = Vector3(0, 0, -1)
collision_mask = 2
[node name="right" type="RayCast3D" parent="WallHugSystem"]
target_position = Vector3(1, 0, 0)
collision_mask = 2
[node name="left" type="RayCast3D" parent="WallHugSystem"]
target_position = Vector3(-1, 0, 0)
collision_mask = 2
[node name="StateChart" type="Node" parent="."]
script = ExtResource("25_wv70j")
metadata/_custom_type_script = "uid://couw105c3bde4"
@ -273,7 +294,7 @@ script = ExtResource("27_34snm")
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Hanging"]
script = ExtResource("28_n7qhm")
to = NodePath("../../Airborne/Jump")
to = NodePath("../../Airborne/JumpFromWall")
event = &"jump"
delay_in_seconds = "0.0"
@ -283,21 +304,6 @@ to = NodePath("../../Airborne/CoyoteEnabled")
event = &"drop"
delay_in_seconds = "0.0"
[node name="WallHugging" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("27_34snm")
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/WallHugging"]
script = ExtResource("28_n7qhm")
to = NodePath("../../Airborne/Jump")
event = &"jump"
delay_in_seconds = "0.0"
[node name="OnDrop" type="Node" parent="StateChart/Root/Movement/WallHugging"]
script = ExtResource("28_n7qhm")
to = NodePath("../../Airborne/CoyoteEnabled")
event = &"drop"
delay_in_seconds = "0.0"
[node name="Airborne" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("26_infe6")
initial_state = NodePath("CoyoteEnabled")
@ -308,6 +314,21 @@ to = NodePath("../../Grounded")
event = &"grounded"
delay_in_seconds = "0.0"
[node name="OnWallHug" type="Node" parent="StateChart/Root/Movement/Airborne"]
script = ExtResource("28_n7qhm")
to = NodePath("../WallHugging")
event = &"wall_hug"
delay_in_seconds = "0.0"
[node name="WallHugging" type="Node" parent="StateChart/Root/Movement/Airborne"]
script = ExtResource("27_34snm")
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Airborne/WallHugging"]
script = ExtResource("28_n7qhm")
to = NodePath("../../JumpFromWall")
event = &"jump"
delay_in_seconds = "0.0"
[node name="CoyoteEnabled" type="Node" parent="StateChart/Root/Movement/Airborne"]
script = ExtResource("27_34snm")
@ -332,6 +353,15 @@ to = NodePath("../../DoubleJumpEnabled")
event = &"to_double_jump"
delay_in_seconds = "0.0"
[node name="JumpFromWall" type="Node" parent="StateChart/Root/Movement/Airborne"]
script = ExtResource("27_34snm")
[node name="ToDoubleJump" type="Node" parent="StateChart/Root/Movement/Airborne/JumpFromWall"]
script = ExtResource("28_n7qhm")
to = NodePath("../../DoubleJumpEnabled")
event = &"to_double_jump"
delay_in_seconds = "0.0"
[node name="DoubleJumpEnabled" type="Node" parent="StateChart/Root/Movement/Airborne"]
script = ExtResource("27_34snm")