dash and jump
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=41 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||
[gd_scene load_steps=44 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="Curve" uid="uid://c2a8soliruf35" path="res://systems/dash/dash_time_dilation.tres" id="2_2q0ik"]
|
||||
@ -8,7 +8,6 @@
|
||||
[ext_resource type="Script" uid="uid://dv7v1ywmbvvcd" path="res://player_controller/Scripts/HealthSystem.cs" id="5_umw0l"]
|
||||
[ext_resource type="Script" uid="uid://vuq8rjq3vegn" path="res://player_controller/Scripts/Stamina.cs" id="6_lxtc4"]
|
||||
[ext_resource type="Script" uid="uid://cwbvxlfvmocc1" path="res://player_controller/Scripts/StairsSystem.cs" id="7_bmt5a"]
|
||||
[ext_resource type="Resource" uid="uid://dgfww8118d8gj" path="res://systems/inputs/base_mode/aim.tres" id="7_cresl"]
|
||||
[ext_resource type="Resource" uid="uid://j1o5ud0plk4" path="res://systems/inputs/base_mode/aim_release.tres" id="8_lhb11"]
|
||||
[ext_resource type="Script" uid="uid://dd1yrt7eiiyf4" path="res://player_controller/Scripts/CapsuleCollider.cs" id="8_lmtjd"]
|
||||
[ext_resource type="Resource" uid="uid://c3e0ivgaxrsyb" path="res://systems/inputs/base_mode/aim_down.tres" id="8_obsfv"]
|
||||
@ -17,11 +16,14 @@
|
||||
[ext_resource type="Script" uid="uid://bt0xv2q8iv1vn" path="res://player_controller/Scripts/Gravity.cs" id="9_lsueh"]
|
||||
[ext_resource type="Resource" uid="uid://bdit2jy5gbpts" path="res://systems/inputs/base_mode/jump.tres" id="10_4u7i3"]
|
||||
[ext_resource type="Script" uid="uid://g8idirw62qe0" path="res://player_controller/Scripts/Bobbing.cs" id="10_7wk1w"]
|
||||
[ext_resource type="Resource" uid="uid://b334rau1yxmm7" path="res://systems/inputs/base_mode/empower_down.tres" id="10_nodcl"]
|
||||
[ext_resource type="Resource" uid="uid://b5gx3q8nvu72e" path="res://systems/inputs/base_mode/hit.tres" id="11_cresl"]
|
||||
[ext_resource type="Resource" uid="uid://bbce5wfwxpns1" path="res://systems/inputs/base_mode/empower_release.tres" id="11_ruloh"]
|
||||
[ext_resource type="PackedScene" uid="uid://0ysqmqphq6mq" path="res://systems/head/head_system.tscn" id="11_rxwoh"]
|
||||
[ext_resource type="Resource" uid="uid://d2r0ur8k3cuu3" path="res://systems/inputs/base_mode/drop.tres" id="12_34snm"]
|
||||
[ext_resource type="Resource" uid="uid://d2r0ur8k3cuu3" path="res://systems/inputs/base_mode/dash.tres" id="12_34snm"]
|
||||
[ext_resource type="Script" uid="uid://b6k73aj5povgv" path="res://player_controller/Scripts/FieldOfView.cs" id="12_m2mxi"]
|
||||
[ext_resource type="Shape3D" uid="uid://keseacdcooot" path="res://player_controller/resources/PlayerShape.tres" id="13_r7i3q"]
|
||||
[ext_resource type="Resource" uid="uid://bw5k2gsv3jqcv" path="res://systems/inputs/base_mode/throw.tres" id="16_nob5r"]
|
||||
[ext_resource type="Script" uid="uid://b5nk6ntlps3x0" path="res://systems/inputs/input_system.gd" id="16_v31n3"]
|
||||
[ext_resource type="Resource" uid="uid://htqvokm8mufq" path="res://systems/inputs/base_mode/move.tres" id="17_h6vvl"]
|
||||
[ext_resource type="PackedScene" uid="uid://cqduhd4opgwvm" path="res://systems/dash/dash_system.tscn" id="18_q5h8a"]
|
||||
@ -38,6 +40,7 @@
|
||||
[ext_resource type="Script" uid="uid://bhuwv2nlcrunt" path="res://player_controller/PlayerUi.cs" id="30_2ghaa"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnwj7ltdfximr" path="res://icon.svg" id="30_h23go"]
|
||||
[ext_resource type="Texture2D" uid="uid://chvt6g0xn5c2m" path="res://systems/dash/light-ring.jpg" id="32_lgpc8"]
|
||||
[ext_resource type="Script" uid="uid://b4dwolbvt8our" path="res://addons/godot_state_charts/history_state.gd" id="41_ruloh"]
|
||||
|
||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
|
||||
height = 1.7
|
||||
@ -50,6 +53,7 @@ script = ExtResource("1_poq2x")
|
||||
TimeScaleAimInAir = 0.15
|
||||
MaxJumpBoostAfterDashing = 0.7
|
||||
MaxNumberOfDashActions = 2
|
||||
BasicDashStrength = 15.0
|
||||
DashTimeDilationCurve = ExtResource("2_2q0ik")
|
||||
|
||||
[node name="InputController" type="Node3D" parent="."]
|
||||
@ -58,13 +62,15 @@ base_mode = ExtResource("3_cresl")
|
||||
move = ExtResource("17_h6vvl")
|
||||
rotate_y = ExtResource("4_rxwoh")
|
||||
rotate_floorplane = ExtResource("5_4u7i3")
|
||||
aim_pressed = ExtResource("7_cresl")
|
||||
aim_down = ExtResource("8_obsfv")
|
||||
aim_released = ExtResource("8_lhb11")
|
||||
empower_down = ExtResource("10_nodcl")
|
||||
empower_released = ExtResource("11_ruloh")
|
||||
aim_canceled = ExtResource("9_5p2qc")
|
||||
jump = ExtResource("10_4u7i3")
|
||||
hit = ExtResource("11_cresl")
|
||||
drop = ExtResource("12_34snm")
|
||||
dash = ExtResource("12_34snm")
|
||||
throw = ExtResource("16_nob5r")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.85, 0)
|
||||
@ -130,7 +136,8 @@ target_position = Vector3(0, 1, 0)
|
||||
script = ExtResource("20_rxwoh")
|
||||
WalkSpeed = 7.2
|
||||
DecelerationSpeedFactorFloor = 7.0
|
||||
ApexHoldTime = 0.1
|
||||
ApexHoldTime = 0.2
|
||||
WallHugGravityReducingFactor = 0.2
|
||||
|
||||
[node name="Gravity" type="Node3D" parent="."]
|
||||
script = ExtResource("9_lsueh")
|
||||
@ -251,99 +258,99 @@ metadata/_custom_type_script = "uid://couw105c3bde4"
|
||||
[node name="Root" type="Node" parent="StateChart"]
|
||||
script = ExtResource("27_infe6")
|
||||
|
||||
[node name="Actions" type="Node" parent="StateChart/Root"]
|
||||
[node name="Aim" type="Node" parent="StateChart/Root"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("WeaponInHand")
|
||||
metadata/_custom_type_script = "uid://c1vp0ojjvaby1"
|
||||
initial_state = NodePath("Off")
|
||||
|
||||
[node name="AimCanceled" type="Node" parent="StateChart/Root/Actions"]
|
||||
[node name="Off" type="Node" parent="StateChart/Root/Aim"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="ToWeaponInHand" type="Node" parent="StateChart/Root/Actions/AimCanceled"]
|
||||
[node name="ToOn" type="Node" parent="StateChart/Root/Aim/Off"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../WeaponInHand")
|
||||
event = &"aim_released"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="WeaponInHand" type="Node" parent="StateChart/Root/Actions"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="ToAiming" type="Node" parent="StateChart/Root/Actions/WeaponInHand"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Aiming")
|
||||
to = NodePath("../../On")
|
||||
event = &"aim_down"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Aiming" type="Node" parent="StateChart/Root/Actions"]
|
||||
[node name="On" type="Node" parent="StateChart/Root/Aim"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="ToWeaponInHand" type="Node" parent="StateChart/Root/Actions/Aiming"]
|
||||
[node name="ToOff" type="Node" parent="StateChart/Root/Aim/On"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../AimCanceled")
|
||||
event = &"aim_canceled"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="ToDashing" type="Node" parent="StateChart/Root/Actions/Aiming"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Dashing")
|
||||
to = NodePath("../../Off")
|
||||
event = &"aim_released"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="ToWeaponThrown" type="Node" parent="StateChart/Root/Actions/Aiming"]
|
||||
[node name="Empower" type="Node" parent="StateChart/Root"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("Off")
|
||||
|
||||
[node name="Off" type="Node" parent="StateChart/Root/Empower"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="ToOn" type="Node" parent="StateChart/Root/Empower/Off"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../WeaponThrown")
|
||||
event = &"hit_pressed"
|
||||
to = NodePath("../../On")
|
||||
event = &"empower_down"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="On" type="Node" parent="StateChart/Root/Empower"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="ToOff" type="Node" parent="StateChart/Root/Empower/On"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Off")
|
||||
event = &"empower_released"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Actions" type="Node" parent="StateChart/Root"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("Default")
|
||||
|
||||
[node name="Default" type="Node" parent="StateChart/Root/Actions"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="Jumping" type="Node" parent="StateChart/Root/Actions"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="Dashing" type="Node" parent="StateChart/Root/Actions"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="ToWeaponInHand" type="Node" parent="StateChart/Root/Actions/Dashing"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../WeaponInHand")
|
||||
event = &"dash_ended"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="ToHanging" type="Node" parent="StateChart/Root/Actions/Dashing"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Hanging")
|
||||
event = &"dash_to_planted"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="WeaponThrown" type="Node" parent="StateChart/Root/Actions"]
|
||||
[node name="Hitting" type="Node" parent="StateChart/Root/Actions"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnAim" type="Node" parent="StateChart/Root/Actions/WeaponThrown"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Dashing")
|
||||
event = &"aim_pressed"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Hanging" type="Node" parent="StateChart/Root/Actions"]
|
||||
[node name="Throwing" type="Node" parent="StateChart/Root/Actions"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnJump" type="Node" parent="StateChart/Root/Actions/Hanging"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../WeaponInHand")
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
[node name="WeaponState" type="Node" parent="StateChart/Root"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("InHand")
|
||||
metadata/_custom_type_script = "uid://c1vp0ojjvaby1"
|
||||
|
||||
[node name="OnDrop" type="Node" parent="StateChart/Root/Actions/Hanging"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../WeaponInHand")
|
||||
event = &"crouch"
|
||||
delay_in_seconds = "0.0"
|
||||
[node name="InHand" type="Node" parent="StateChart/Root/WeaponState"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnMantle" type="Node" parent="StateChart/Root/Actions/Hanging"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../WeaponInHand")
|
||||
event = &"mantle"
|
||||
delay_in_seconds = "0.0"
|
||||
[node name="Flying" type="Node" parent="StateChart/Root/WeaponState"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="Planted" type="Node" parent="StateChart/Root/WeaponState"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="Movement" type="Node" parent="StateChart/Root"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("Grounded")
|
||||
|
||||
[node name="OnFall" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../Airborne/Falling")
|
||||
event = &"falling"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnGrounded" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../Grounded/Standing")
|
||||
event = &"grounded"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnMantle" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../Mantling")
|
||||
@ -352,10 +359,41 @@ delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnHang" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../Hanging")
|
||||
to = NodePath("../OnWall/Hanging")
|
||||
event = &"dash_to_planted"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnDash" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../Dashing")
|
||||
event = &"dash"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Dashing" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnDashEnded" type="Node" parent="StateChart/Root/Movement/Dashing"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Airborne/Reset")
|
||||
event = &"dash_ended"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Mantling" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="Jump" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("Normal")
|
||||
|
||||
[node name="Normal" type="Node" parent="StateChart/Root/Movement/Jump"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="Double" type="Node" parent="StateChart/Root/Movement/Jump"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="Empowered" type="Node" parent="StateChart/Root/Movement/Jump"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="Grounded" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("Standing")
|
||||
@ -365,7 +403,7 @@ script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Grounded/Standing"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../../Airborne/Jump")
|
||||
to = NodePath("../../../Airborne/DoubleJumpEnabled")
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
@ -386,7 +424,7 @@ script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Grounded/Crouched"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../../Airborne/Jump")
|
||||
to = NodePath("../../../Airborne/DoubleJumpEnabled")
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
@ -402,67 +440,26 @@ to = NodePath("../../Standing")
|
||||
event = &"crouch"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Mantling" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="ToGrounded" type="Node" parent="StateChart/Root/Movement/Mantling"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Grounded/Standing")
|
||||
event = &"to_grounded"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Hanging" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Hanging"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Airborne/JumpFromWall")
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnDrop" type="Node" parent="StateChart/Root/Movement/Hanging"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Airborne/CoyoteEnabled")
|
||||
event = &"crouch"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Airborne" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("CoyoteEnabled")
|
||||
|
||||
[node name="OnGrounded" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Grounded/Standing")
|
||||
event = &"grounded"
|
||||
delay_in_seconds = "0.0"
|
||||
[node name="Reset" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
script = ExtResource("41_ruloh")
|
||||
default_state = NodePath("../CoyoteEnabled")
|
||||
|
||||
[node name="OnWallHug" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../WallHugging")
|
||||
to = NodePath("../../OnWall/Hugging")
|
||||
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="OnLeaveWall" type="Node" parent="StateChart/Root/Movement/Airborne/WallHugging"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Falling")
|
||||
event = &"start_falling"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="CoyoteEnabled" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Airborne/CoyoteEnabled"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Jump")
|
||||
to = NodePath("../../DoubleJumpEnabled")
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
@ -472,52 +469,13 @@ to = NodePath("../../DoubleJumpEnabled")
|
||||
event = &"coyote_expired"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Jump" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="ToDoubleJump" type="Node" parent="StateChart/Root/Movement/Airborne/Jump"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../DoubleJumpEnabled")
|
||||
event = &"to_double_jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="ToFalling" type="Node" parent="StateChart/Root/Movement/Airborne/Jump"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Falling")
|
||||
event = &"jump_from_dash"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="JumpFromWall" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="JumpedFromWall" type="Node" parent="StateChart/Root/Movement/Airborne/JumpFromWall"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Falling")
|
||||
event = &"jump_from_wall"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="ToFalling" type="Node" parent="StateChart/Root/Movement/Airborne/JumpFromWall"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Falling")
|
||||
event = &"jump_from_dash"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="DoubleJumpEnabled" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Airborne/DoubleJumpEnabled"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../DoubleJump")
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="DoubleJump" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="ToFalling" type="Node" parent="StateChart/Root/Movement/Airborne/DoubleJump"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Falling")
|
||||
event = &"to_falling"
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Falling" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||
@ -529,13 +487,43 @@ to = NodePath("../../DoubleJumpEnabled")
|
||||
event = &"enable_double_jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnWall" type="Node" parent="StateChart/Root/Movement"]
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("Hugging")
|
||||
|
||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Airborne/DoubleJumpEnabled")
|
||||
event = &"jump"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Hugging" type="Node" parent="StateChart/Root/Movement/OnWall"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnLeaveWall" type="Node" parent="StateChart/Root/Movement/OnWall/Hugging"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../../Airborne/CoyoteEnabled")
|
||||
event = &"start_falling"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Hanging" type="Node" parent="StateChart/Root/Movement/OnWall"]
|
||||
script = ExtResource("27_34snm")
|
||||
|
||||
[node name="OnDrop" type="Node" parent="StateChart/Root/Movement/OnWall/Hanging"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../../Airborne/CoyoteEnabled")
|
||||
event = &"cancel"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[connection signal="input_aim_canceled" from="InputController" to="." method="OnInputAimCanceled"]
|
||||
[connection signal="input_aim_down" from="InputController" to="." method="OnInputAimDown"]
|
||||
[connection signal="input_aim_pressed" from="InputController" to="." method="OnInputAimPressed"]
|
||||
[connection signal="input_aim_released" from="InputController" to="." method="OnInputAimReleased"]
|
||||
[connection signal="input_drop" from="InputController" to="." method="OnInputDropPressed"]
|
||||
[connection signal="input_dash" from="InputController" to="." method="OnInputDashPressed"]
|
||||
[connection signal="input_empower_down" from="InputController" to="." method="OnInputEmpowerDown"]
|
||||
[connection signal="input_empower_released" from="InputController" to="." method="OnInputEmpowerReleased"]
|
||||
[connection signal="input_hit" from="InputController" to="." method="OnInputHitPressed"]
|
||||
[connection signal="input_jump" from="InputController" to="." method="OnInputJumpPressed"]
|
||||
[connection signal="input_move" from="InputController" to="." method="OnInputMove"]
|
||||
[connection signal="input_rotate_floorplane" from="InputController" to="." method="OnInputRotateFloorplane"]
|
||||
[connection signal="input_rotate_y" from="InputController" to="." method="OnInputRotateY"]
|
||||
[connection signal="input_throw" from="InputController" to="." method="OnInputThrowPressed"]
|
||||
|
@ -58,6 +58,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
public int DashIndicatorStartSize { get; set; } = 100;
|
||||
[Export(PropertyHint.Range, "0,1,0.01")]
|
||||
public float DashProgressAfterWhichToAct { get; set; } = 0.8f;
|
||||
[Export(PropertyHint.Range, "0,50,0.1")]
|
||||
public float BasicDashStrength { get; set; } = 10f;
|
||||
|
||||
[Export]
|
||||
public Curve DashTimeDilationCurve { get; set; }
|
||||
@ -76,25 +78,26 @@ public partial class PlayerController : CharacterBody3D
|
||||
private bool _isWallJumpAvailable = true;
|
||||
|
||||
private StateChart _playerState;
|
||||
// Actions state
|
||||
|
||||
private StateChartState _weaponInHand;
|
||||
private StateChartState _aiming;
|
||||
private StateChartState _dashing;
|
||||
private StateChartState _weaponThrown;
|
||||
private StateChartState _actionHanging;
|
||||
// Movement state
|
||||
private StateChartState _empowerOn;
|
||||
private StateChartState _empowerOff;
|
||||
|
||||
private StateChartState _grounded;
|
||||
private StateChartState _crouched;
|
||||
private StateChartState _standing;
|
||||
private StateChartState _mantling;
|
||||
private StateChartState _movHanging;
|
||||
private StateChartState _wallHugging;
|
||||
private StateChartState _airborne;
|
||||
private StateChartState _coyoteEnabled;
|
||||
private StateChartState _jump;
|
||||
private StateChartState _jumpFromWall;
|
||||
private StateChartState _doubleJumpEnabled;
|
||||
private StateChartState _doubleJump;
|
||||
private StateChartState _onWall;
|
||||
private StateChartState _onWallHugging;
|
||||
private StateChartState _onWallHanging;
|
||||
private StateChartState _falling;
|
||||
|
||||
public override void _Ready()
|
||||
@ -147,25 +150,26 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
// State management
|
||||
_playerState = StateChart.Of(GetNode("StateChart"));
|
||||
// Actions states
|
||||
_weaponInHand = StateChartState.Of(GetNode("StateChart/Root/Actions/WeaponInHand"));
|
||||
_aiming = StateChartState.Of(GetNode("StateChart/Root/Actions/Aiming"));
|
||||
_dashing = StateChartState.Of(GetNode("StateChart/Root/Actions/Dashing"));
|
||||
_weaponThrown = StateChartState.Of(GetNode("StateChart/Root/Actions/WeaponThrown"));
|
||||
_actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging"));
|
||||
// Movement states
|
||||
|
||||
_weaponInHand = StateChartState.Of(GetNode("StateChart/Root/WeaponState/InHand"));
|
||||
_weaponThrown = StateChartState.Of(GetNode("StateChart/Root/WeaponState/Flying"));
|
||||
_aiming = StateChartState.Of(GetNode("StateChart/Root/Aim/On"));
|
||||
_dashing = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing"));
|
||||
// _actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging"));
|
||||
_empowerOn = StateChartState.Of(GetNode("StateChart/Root/Empower/On"));
|
||||
_empowerOff = StateChartState.Of(GetNode("StateChart/Root/Empower/Off"));
|
||||
|
||||
_grounded = StateChartState.Of(GetNode("StateChart/Root/Movement/Grounded"));
|
||||
_standing = StateChartState.Of(GetNode("StateChart/Root/Movement/Grounded/Standing"));
|
||||
_crouched = StateChartState.Of(GetNode("StateChart/Root/Movement/Grounded/Crouched"));
|
||||
_mantling = StateChartState.Of(GetNode("StateChart/Root/Movement/Mantling"));
|
||||
_movHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/Hanging"));
|
||||
_movHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hanging"));
|
||||
_airborne = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne"));
|
||||
_wallHugging = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/WallHugging"));
|
||||
_coyoteEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/CoyoteEnabled"));
|
||||
_jump = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/Jump"));
|
||||
_jumpFromWall = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/JumpFromWall"));
|
||||
_doubleJumpEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/DoubleJumpEnabled"));
|
||||
_doubleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/DoubleJump"));
|
||||
_onWall = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall"));
|
||||
_onWallHugging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hugging"));
|
||||
_onWallHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hanging"));
|
||||
_falling = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/Falling"));
|
||||
// State timers
|
||||
_coyoteTimer = GetNode<Timer>("CoyoteTime");
|
||||
@ -231,17 +235,13 @@ public partial class PlayerController : CharacterBody3D
|
||||
_grounded.StateEntered += OnGrounded;
|
||||
_grounded.StatePhysicsProcessing += HandleGrounded;
|
||||
_airborne.StatePhysicsProcessing += HandleAirborne;
|
||||
_wallHugging.StatePhysicsProcessing += HandleWallHugging;
|
||||
_onWallHugging.StatePhysicsProcessing += HandleWallHugging;
|
||||
|
||||
_coyoteEnabled.StateEntered += StartCoyoteTime;
|
||||
_coyoteTimer.Timeout += CoyoteExpired;
|
||||
_timeScaleAimInAirTimer.Timeout += ResetTimeScale;
|
||||
_jump.StateEntered += Jump;
|
||||
_jumpFromWall.StateEntered += JumpFromWall;
|
||||
_doubleJump.StateEntered += DoubleJump;
|
||||
_mantling.StateEntered += Mantle;
|
||||
|
||||
_dashing.StateEntered += OnDashStarted;
|
||||
_dashing.StatePhysicsProcessing += Dashing;
|
||||
_weaponThrown.StateEntered += OnWeaponThrown;
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
}
|
||||
public void OnInputAimCanceled()
|
||||
{
|
||||
_playerState.SendEvent("aim_canceled");
|
||||
_playerState.SendEvent("cancel");
|
||||
DashSystem.CancelDash();
|
||||
}
|
||||
public void OnInputHitPressed()
|
||||
@ -286,16 +286,56 @@ public partial class PlayerController : CharacterBody3D
|
||||
{
|
||||
if (MoveSystem.CanMantle())
|
||||
{
|
||||
_playerState.SendEvent("mantle");
|
||||
Mantle();
|
||||
return;
|
||||
}
|
||||
if (_grounded.Active || _coyoteEnabled.Active)
|
||||
if (_empowerOn.Active)
|
||||
PerformJump(MoveSystem.JumpTypes.JumpFromDash);
|
||||
else
|
||||
Jump();
|
||||
else if (_doubleJumpEnabled.Active)
|
||||
if (_empowerOn.Active)
|
||||
PerformJump(MoveSystem.JumpTypes.JumpFromDash);
|
||||
else
|
||||
DoubleJump();
|
||||
else if (_onWall.Active)
|
||||
JumpFromWall(_empowerOn.Active);
|
||||
|
||||
_playerState.SendEvent("jump");
|
||||
|
||||
}
|
||||
public void OnInputDropPressed()
|
||||
public void OnInputDashPressed()
|
||||
{
|
||||
_playerState.SendEvent("crouch");
|
||||
_playerState.SendEvent("dash");
|
||||
PerformDash(_empowerOn.Active);
|
||||
}
|
||||
public void OnInputThrowPressed()
|
||||
{
|
||||
_playerState.SendEvent("throw");
|
||||
}
|
||||
public void OnInputEmpowerDown()
|
||||
{
|
||||
_playerState.SendEvent("empower_down");
|
||||
}
|
||||
public void OnInputEmpowerReleased()
|
||||
{
|
||||
_playerState.SendEvent("empower_released");
|
||||
}
|
||||
|
||||
public void PerformDash(bool isEmpowered)
|
||||
{
|
||||
var direction = HeadSystem.Transform.Basis * _inputMove;
|
||||
var planarDirection = new Vector3(direction.X, 0, direction.Z).Normalized();
|
||||
var dashStrength = isEmpowered ? BasicDashStrength * 2.5f : BasicDashStrength;
|
||||
SetVelocity(planarDirection * dashStrength);
|
||||
}
|
||||
|
||||
public void Dashing(float delta)
|
||||
{
|
||||
_playerState.SendEvent("dash_ended");
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////
|
||||
// Stateful logic /////////
|
||||
@ -308,12 +348,12 @@ public partial class PlayerController : CharacterBody3D
|
||||
_isWallJumpAvailable = true;
|
||||
}
|
||||
|
||||
public bool CanPerformDashAction()
|
||||
public bool CanPerformEmpoweredAction()
|
||||
{
|
||||
return DashActionsLeft > 0 && _dashCooldownTimer.IsStopped();
|
||||
}
|
||||
|
||||
public void PerformDashAction()
|
||||
public void PerformEmpoweredAction()
|
||||
{
|
||||
_isWallJumpAvailable = true;
|
||||
_dashCooldownTimer.Start();
|
||||
@ -331,41 +371,37 @@ public partial class PlayerController : CharacterBody3D
|
||||
}
|
||||
public void Jump()
|
||||
{
|
||||
if (_aiming.Active && CanPerformDashAction())
|
||||
if (_aiming.Active && CanPerformEmpoweredAction())
|
||||
{
|
||||
_playerState.SendEvent("jump_from_dash");
|
||||
PerformDashAction();
|
||||
PerformEmpoweredAction();
|
||||
PerformJump(MoveSystem.JumpTypes.JumpFromDash);
|
||||
return;
|
||||
}
|
||||
_playerState.SendEvent("to_double_jump");
|
||||
PerformJump(MoveSystem.JumpTypes.SimpleJump);
|
||||
}
|
||||
public void JumpFromWall()
|
||||
public void JumpFromWall(bool isEmpowered)
|
||||
{
|
||||
if (!_isWallJumpAvailable)
|
||||
return;
|
||||
|
||||
_isWallJumpAvailable = false;
|
||||
var wallNormal = WallHugSystem.GetWallNormal().UnwrapOr(Vector3.Up);
|
||||
var isLookingTowardsWall = HeadSystem.GetForwardHorizontalVector().Dot(wallNormal) > 0.7;
|
||||
var isLookingTowardsWall = HeadSystem.GetForwardHorizontalVector().Dot(wallNormal) > 0.5;
|
||||
var jumpDirection = isLookingTowardsWall ? Vector3.Up : wallNormal;
|
||||
if (_aiming.Active && CanPerformDashAction())
|
||||
if (isEmpowered && CanPerformEmpoweredAction())
|
||||
{
|
||||
_playerState.SendEvent("jump_from_dash");
|
||||
PerformDashAction();
|
||||
PerformEmpoweredAction();
|
||||
PerformJump(MoveSystem.JumpTypes.JumpFromDash, jumpDirection);
|
||||
return;
|
||||
}
|
||||
_playerState.SendEvent("jump_from_wall");
|
||||
PerformJump(MoveSystem.JumpTypes.JumpFromWall, jumpDirection);
|
||||
}
|
||||
public void DoubleJump()
|
||||
{
|
||||
_playerState.SendEvent("to_falling");
|
||||
if (_aiming.Active && CanPerformDashAction())
|
||||
if (_aiming.Active && CanPerformEmpoweredAction())
|
||||
{
|
||||
PerformDashAction();
|
||||
PerformEmpoweredAction();
|
||||
PerformJump(MoveSystem.JumpTypes.JumpFromDash);
|
||||
return;
|
||||
}
|
||||
@ -392,19 +428,20 @@ public partial class PlayerController : CharacterBody3D
|
||||
// Mantling
|
||||
public void Mantle()
|
||||
{
|
||||
_playerState.SendEvent("mantle");
|
||||
var optionTween = MoveSystem.Mantle();
|
||||
if (optionTween.IsSome(out var tween))
|
||||
tween.Finished += MantleFinished;
|
||||
}
|
||||
public void MantleFinished()
|
||||
{
|
||||
_playerState.SendEvent("to_grounded");
|
||||
_playerState.SendEvent("grounded");
|
||||
}
|
||||
|
||||
// Dashing and weapon throwing
|
||||
public void OnDashStarted()
|
||||
{
|
||||
if (!CanPerformDashAction())
|
||||
if (!CanPerformEmpoweredAction())
|
||||
{
|
||||
_playerState.SendEvent("aim_canceled");
|
||||
_playerState.SendEvent("dash_ended");
|
||||
@ -412,7 +449,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
return;
|
||||
}
|
||||
|
||||
PerformDashAction();
|
||||
PerformEmpoweredAction();
|
||||
_timeAfterDashingTimer.Start();
|
||||
if (WeaponSystem.FlyingState.Active)
|
||||
{
|
||||
@ -503,7 +540,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
}
|
||||
public void OnAimingEntered()
|
||||
{
|
||||
if (!isOnFloorCustom() && CanPerformDashAction())
|
||||
if (!isOnFloorCustom() && CanPerformEmpoweredAction())
|
||||
ReduceTimeScaleWhileAiming();
|
||||
}
|
||||
|
||||
@ -517,7 +554,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
RotateWeaponWithPlayer();
|
||||
if (isOnFloorCustom())
|
||||
ResetTimeScale();
|
||||
if (CanPerformDashAction())
|
||||
if (CanPerformEmpoweredAction())
|
||||
DashSystem.PrepareDash();
|
||||
else
|
||||
{
|
||||
@ -551,6 +588,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
}
|
||||
public void HandleWallHugging(float delta)
|
||||
{
|
||||
if (isOnFloorCustom())
|
||||
_playerState.SendEvent("grounded");
|
||||
if (!WallHugSystem.IsWallHugging())
|
||||
_playerState.SendEvent("start_falling");
|
||||
}
|
||||
@ -572,8 +611,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
isOnFloorCustom(),
|
||||
HealthSystem.IsDead(),
|
||||
IsHeadTouchingCeiling(),
|
||||
_actionHanging.Active,
|
||||
_wallHugging.Active);
|
||||
_onWallHanging.Active,
|
||||
_onWallHugging.Active);
|
||||
MoveSystem.MoveAround(moveAroundParams);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user