Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
374012569b | |||
98b6537fdd | |||
e3d10840c9 | |||
e4880d42f9 | |||
ef16d6c83f |
@ -3,25 +3,27 @@
|
|||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://bnwj7ltdfximr"
|
uid="uid://bnwj7ltdfximr"
|
||||||
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
|
path.s3tc="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex"
|
||||||
|
path.etc2="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.etc2.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||||
|
"vram_texture": true
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://icon.svg"
|
source_file="res://icon.svg"
|
||||||
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
|
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.s3tc.ctex", "res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.etc2.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
||||||
compress/mode=0
|
compress/mode=2
|
||||||
compress/high_quality=false
|
compress/high_quality=false
|
||||||
compress/lossy_quality=0.7
|
compress/lossy_quality=0.7
|
||||||
compress/hdr_compression=1
|
compress/hdr_compression=1
|
||||||
compress/normal_map=0
|
compress/normal_map=0
|
||||||
compress/channel_pack=0
|
compress/channel_pack=0
|
||||||
mipmaps/generate=false
|
mipmaps/generate=true
|
||||||
mipmaps/limit=-1
|
mipmaps/limit=-1
|
||||||
roughness/mode=0
|
roughness/mode=0
|
||||||
roughness/src_normal=""
|
roughness/src_normal=""
|
||||||
@ -31,7 +33,7 @@ process/normal_map_invert_y=false
|
|||||||
process/hdr_as_srgb=false
|
process/hdr_as_srgb=false
|
||||||
process/hdr_clamp_exposure=false
|
process/hdr_clamp_exposure=false
|
||||||
process/size_limit=0
|
process/size_limit=0
|
||||||
detect_3d/compress_to=1
|
detect_3d/compress_to=0
|
||||||
svg/scale=1.0
|
svg/scale=1.0
|
||||||
editor/scale_with_editor_scale=false
|
editor/scale_with_editor_scale=false
|
||||||
editor/convert_colors_with_editor_theme=false
|
editor/convert_colors_with_editor_theme=false
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
[gd_scene load_steps=36 format=3 uid="uid://bei4nhkf8lwdo"]
|
[gd_scene load_steps=41 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="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"]
|
||||||
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://systems/inputs/base_mode/base_mode.tres" id="3_cresl"]
|
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://systems/inputs/base_mode/base_mode.tres" id="3_cresl"]
|
||||||
[ext_resource type="Resource" uid="uid://cpdaw41ah5gic" path="res://systems/inputs/base_mode/rotate_y.tres" id="4_rxwoh"]
|
[ext_resource type="Resource" uid="uid://cpdaw41ah5gic" path="res://systems/inputs/base_mode/rotate_y.tres" id="4_rxwoh"]
|
||||||
[ext_resource type="Resource" uid="uid://ccrb5xsnphc8" path="res://systems/inputs/base_mode/rotate_floorplane.tres" id="5_4u7i3"]
|
[ext_resource type="Resource" uid="uid://ccrb5xsnphc8" path="res://systems/inputs/base_mode/rotate_floorplane.tres" id="5_4u7i3"]
|
||||||
@ -34,15 +35,22 @@
|
|||||||
[ext_resource type="Script" uid="uid://tjiji63wlom5" path="res://systems/wall_hug/WallHugSystem.cs" id="27_n7qhm"]
|
[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="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"]
|
[ext_resource type="PackedScene" uid="uid://ckm3d6k08a72u" path="res://systems/weapon/weapon.tscn" id="29_wv70j"]
|
||||||
|
[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"]
|
||||||
|
|
||||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
|
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
|
||||||
height = 1.7
|
height = 1.7
|
||||||
|
|
||||||
|
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_2q0ik"]
|
||||||
|
blend_mode = 1
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody3D"]
|
[node name="Player" type="CharacterBody3D"]
|
||||||
script = ExtResource("1_poq2x")
|
script = ExtResource("1_poq2x")
|
||||||
TimeScaleAimInAir = 0.15
|
TimeScaleAimInAir = 0.15
|
||||||
MaxJumpBoostAfterDashing = 0.7
|
MaxJumpBoostAfterDashing = 0.7
|
||||||
MaxNumberOfDashActions = 3
|
MaxNumberOfDashActions = 2
|
||||||
|
DashTimeDilationCurve = ExtResource("2_2q0ik")
|
||||||
|
|
||||||
[node name="InputController" type="Node3D" parent="."]
|
[node name="InputController" type="Node3D" parent="."]
|
||||||
script = ExtResource("16_v31n3")
|
script = ExtResource("16_v31n3")
|
||||||
@ -153,7 +161,7 @@ target_position = Vector3(-1, 0, 0)
|
|||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
|
|
||||||
[node name="DashSystem" parent="." instance=ExtResource("18_q5h8a")]
|
[node name="DashSystem" parent="." instance=ExtResource("18_q5h8a")]
|
||||||
DashSpeed = 0.1
|
DashSpeed = 0.2
|
||||||
PostDashSpeed = 30.0
|
PostDashSpeed = 30.0
|
||||||
|
|
||||||
[node name="WeaponRoot" type="Node3D" parent="."]
|
[node name="WeaponRoot" type="Node3D" parent="."]
|
||||||
@ -181,12 +189,61 @@ wait_time = 0.3
|
|||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
[node name="StateChartDebugger" parent="." instance=ExtResource("24_q5h8a")]
|
[node name="StateChartDebugger" parent="." instance=ExtResource("24_q5h8a")]
|
||||||
offset_left = 1530.0
|
offset_left = 1524.0
|
||||||
offset_top = 1.0
|
offset_top = 1.0
|
||||||
offset_right = -2.0
|
offset_right = -8.0
|
||||||
offset_bottom = 1.0
|
offset_bottom = 1.0
|
||||||
initial_node_to_watch = NodePath("../StateChart")
|
initial_node_to_watch = NodePath("../StateChart")
|
||||||
|
|
||||||
|
[node name="UI" type="CanvasLayer" parent="."]
|
||||||
|
script = ExtResource("30_2ghaa")
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="UI"]
|
||||||
|
offset_right = 128.0
|
||||||
|
offset_bottom = 81.0
|
||||||
|
|
||||||
|
[node name="DashesLabel" type="Label" parent="UI/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Dashes"
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="UI/VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(0, 30)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Dash1" type="TextureRect" parent="UI/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("30_h23go")
|
||||||
|
expand_mode = 2
|
||||||
|
|
||||||
|
[node name="Dash2" type="TextureRect" parent="UI/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("30_h23go")
|
||||||
|
expand_mode = 2
|
||||||
|
|
||||||
|
[node name="Dash3" type="TextureRect" parent="UI/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("30_h23go")
|
||||||
|
expand_mode = 2
|
||||||
|
|
||||||
|
[node name="CenterContainer" type="CenterContainer" parent="UI"]
|
||||||
|
custom_minimum_size = Vector2(1920, 1080)
|
||||||
|
offset_right = 1919.0
|
||||||
|
offset_bottom = 1080.0
|
||||||
|
|
||||||
|
[node name="CenterIcon" type="TextureRect" parent="UI/CenterContainer"]
|
||||||
|
material = SubResource("CanvasItemMaterial_2q0ik")
|
||||||
|
custom_minimum_size = Vector2(5, 5)
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("32_lgpc8")
|
||||||
|
expand_mode = 1
|
||||||
|
|
||||||
|
[node name="DashIndicator" type="TextureRect" parent="UI/CenterContainer"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
material = SubResource("CanvasItemMaterial_2q0ik")
|
||||||
|
layout_mode = 2
|
||||||
|
texture = ExtResource("32_lgpc8")
|
||||||
|
expand_mode = 1
|
||||||
|
|
||||||
[node name="StateChart" type="Node" parent="."]
|
[node name="StateChart" type="Node" parent="."]
|
||||||
script = ExtResource("25_wv70j")
|
script = ExtResource("25_wv70j")
|
||||||
metadata/_custom_type_script = "uid://couw105c3bde4"
|
metadata/_custom_type_script = "uid://couw105c3bde4"
|
||||||
@ -320,29 +377,29 @@ delay_in_seconds = "0.0"
|
|||||||
|
|
||||||
[node name="OnCrouch" type="Node" parent="StateChart/Root/Movement/Grounded/Standing"]
|
[node name="OnCrouch" type="Node" parent="StateChart/Root/Movement/Grounded/Standing"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../Crouch")
|
to = NodePath("../../Crouched")
|
||||||
event = &"crouch"
|
event = &"crouch"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="Crouch" type="Node" parent="StateChart/Root/Movement/Grounded"]
|
[node name="Crouched" type="Node" parent="StateChart/Root/Movement/Grounded"]
|
||||||
script = ExtResource("27_34snm")
|
script = ExtResource("27_34snm")
|
||||||
|
|
||||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Grounded/Crouch"]
|
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Grounded/Crouched"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../../Airborne/Jump")
|
to = NodePath("../../../Airborne/Jump")
|
||||||
event = &"jump"
|
event = &"jump"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="OnAirborne" type="Node" parent="StateChart/Root/Movement/Grounded/Crouch"]
|
[node name="OnAirborne" type="Node" parent="StateChart/Root/Movement/Grounded/Crouched"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../../Airborne/CoyoteEnabled")
|
to = NodePath("../../../Airborne/CoyoteEnabled")
|
||||||
event = &"start_falling"
|
event = &"start_falling"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="OnStandUp" type="Node" parent="StateChart/Root/Movement/Grounded/Crouch"]
|
[node name="OnStandUp" type="Node" parent="StateChart/Root/Movement/Grounded/Crouched"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../Standing")
|
to = NodePath("../../Standing")
|
||||||
event = &"stand_up"
|
event = &"crouch"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="Mantling" type="Node" parent="StateChart/Root/Movement"]
|
[node name="Mantling" type="Node" parent="StateChart/Root/Movement"]
|
||||||
|
26
player_controller/PlayerUi.cs
Normal file
26
player_controller/PlayerUi.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public partial class PlayerUi : CanvasLayer
|
||||||
|
{
|
||||||
|
private TextureRect[] _dashIcons = new TextureRect[3];
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
base._Ready();
|
||||||
|
|
||||||
|
_dashIcons[0] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash1");
|
||||||
|
_dashIcons[1] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash2");
|
||||||
|
_dashIcons[2] = GetNode<TextureRect>("VBoxContainer/HBoxContainer/Dash3");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetNumberOfDashesLeft(int numberOfDashes)
|
||||||
|
{
|
||||||
|
int index = 1;
|
||||||
|
foreach (var dashIcon in _dashIcons)
|
||||||
|
{
|
||||||
|
dashIcon.SetVisible(index <= numberOfDashes);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
player_controller/PlayerUi.cs.uid
Normal file
1
player_controller/PlayerUi.cs.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bhuwv2nlcrunt
|
@ -23,6 +23,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
public Node3D WeaponRoot;
|
public Node3D WeaponRoot;
|
||||||
public WeaponSystem WeaponSystem;
|
public WeaponSystem WeaponSystem;
|
||||||
public WallHugSystem WallHugSystem;
|
public WallHugSystem WallHugSystem;
|
||||||
|
public PlayerUi PlayerUi;
|
||||||
|
public TextureRect DashIndicator;
|
||||||
|
|
||||||
private bool _movementEnabled = true;
|
private bool _movementEnabled = true;
|
||||||
|
|
||||||
@ -52,9 +54,25 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
[Export(PropertyHint.Range, "0,5,1,or_greater")]
|
[Export(PropertyHint.Range, "0,5,1,or_greater")]
|
||||||
public int MaxNumberOfDashActions { get; set; } = 1;
|
public int MaxNumberOfDashActions { get; set; } = 1;
|
||||||
|
[Export(PropertyHint.Range, "0,200,1,or_greater")]
|
||||||
public int DashActionsLeft { get; set; }
|
public int DashIndicatorStartSize { get; set; } = 100;
|
||||||
|
[Export(PropertyHint.Range, "0,1,0.01")]
|
||||||
|
public float DashProgressAfterWhichToAct { get; set; } = 0.8f;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Curve DashTimeDilationCurve { get; set; }
|
||||||
|
|
||||||
|
private int _dashActionsLeft;
|
||||||
|
public int DashActionsLeft
|
||||||
|
{
|
||||||
|
get => _dashActionsLeft;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_dashActionsLeft = value;
|
||||||
|
PlayerUi.SetNumberOfDashesLeft(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool _isWallJumpAvailable = true;
|
private bool _isWallJumpAvailable = true;
|
||||||
|
|
||||||
private StateChart _playerState;
|
private StateChart _playerState;
|
||||||
@ -66,6 +84,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
private StateChartState _actionHanging;
|
private StateChartState _actionHanging;
|
||||||
// Movement state
|
// Movement state
|
||||||
private StateChartState _grounded;
|
private StateChartState _grounded;
|
||||||
|
private StateChartState _crouched;
|
||||||
|
private StateChartState _standing;
|
||||||
private StateChartState _mantling;
|
private StateChartState _mantling;
|
||||||
private StateChartState _movHanging;
|
private StateChartState _movHanging;
|
||||||
private StateChartState _wallHugging;
|
private StateChartState _wallHugging;
|
||||||
@ -85,6 +105,9 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
// General use stuff
|
// General use stuff
|
||||||
TweenQueueSystem = GetNode<TweenQueueSystem>("TweenQueueSystem");
|
TweenQueueSystem = GetNode<TweenQueueSystem>("TweenQueueSystem");
|
||||||
|
PlayerUi = GetNode<PlayerUi>("UI");
|
||||||
|
DashIndicator = GetNode<TextureRect>("%DashIndicator");
|
||||||
|
|
||||||
// Node3D mapNode = GetTree().Root.FindChild("Map", true, false) as Node3D;
|
// Node3D mapNode = GetTree().Root.FindChild("Map", true, false) as Node3D;
|
||||||
|
|
||||||
// Camera stuff
|
// Camera stuff
|
||||||
@ -132,6 +155,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
_actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging"));
|
_actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging"));
|
||||||
// Movement states
|
// Movement states
|
||||||
_grounded = StateChartState.Of(GetNode("StateChart/Root/Movement/Grounded"));
|
_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"));
|
_mantling = StateChartState.Of(GetNode("StateChart/Root/Movement/Mantling"));
|
||||||
_movHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/Hanging"));
|
_movHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/Hanging"));
|
||||||
_airborne = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne"));
|
_airborne = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne"));
|
||||||
@ -194,12 +219,15 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
///////////////////////////
|
///////////////////////////
|
||||||
|
|
||||||
DashSystem.DashEnded += OnDashEnded;
|
DashSystem.DashEnded += OnDashEnded;
|
||||||
|
DashSystem.DashProgress += OnDashProgress;
|
||||||
|
|
||||||
_weaponInHand.StateProcessing += HandleWeaponInHand;
|
_weaponInHand.StateProcessing += HandleWeaponInHand;
|
||||||
_aiming.StateProcessing += HandleAiming;
|
_aiming.StateProcessing += HandleAiming;
|
||||||
_aiming.StateEntered += OnAimingEntered;
|
_aiming.StateEntered += OnAimingEntered;
|
||||||
_aiming.StateExited += ResetTimeScale;
|
_aiming.StateExited += ResetTimeScale;
|
||||||
|
|
||||||
|
/*_crouched.StatePhysicsProcessing += HandleGroundedCrouched;
|
||||||
|
_standing.StatePhysicsProcessing += HandleGroundedStanding;*/
|
||||||
_grounded.StateEntered += OnGrounded;
|
_grounded.StateEntered += OnGrounded;
|
||||||
_grounded.StatePhysicsProcessing += HandleGrounded;
|
_grounded.StatePhysicsProcessing += HandleGrounded;
|
||||||
_airborne.StatePhysicsProcessing += HandleAirborne;
|
_airborne.StatePhysicsProcessing += HandleAirborne;
|
||||||
@ -287,7 +315,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
public void PerformDashAction()
|
public void PerformDashAction()
|
||||||
{
|
{
|
||||||
_isWallJumpAvailable = true;
|
_isWallJumpAvailable = true;
|
||||||
_dashCooldownTimer.Start();
|
_dashCooldownTimer.Start();
|
||||||
DashActionsLeft--;
|
DashActionsLeft--;
|
||||||
}
|
}
|
||||||
@ -410,6 +438,15 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
_dashDirection = (DashSystem.PlannedPlayerLocation - GlobalPosition).Normalized();
|
_dashDirection = (DashSystem.PlannedPlayerLocation - GlobalPosition).Normalized();
|
||||||
DashSystem.Dash();
|
DashSystem.Dash();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnDashProgress(float progress)
|
||||||
|
{
|
||||||
|
Engine.SetTimeScale(DashTimeDilationCurve.Sample(progress));
|
||||||
|
|
||||||
|
DashIndicator.SetCustomMinimumSize(Vector2.One * DashIndicatorStartSize * (1 - progress));
|
||||||
|
var indicatorColor = progress < DashProgressAfterWhichToAct ? new Color(1, 1, 1) : new Color(0, 1, 0);
|
||||||
|
DashIndicator.SetModulate(indicatorColor);
|
||||||
|
}
|
||||||
public void OnDashEnded()
|
public void OnDashEnded()
|
||||||
{
|
{
|
||||||
// _playerState.SendEvent("enable_double_jump"); // Allow for double jump after dash -- OP ?
|
// _playerState.SendEvent("enable_double_jump"); // Allow for double jump after dash -- OP ?
|
||||||
@ -495,6 +532,16 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
if (!isOnFloorCustom())
|
if (!isOnFloorCustom())
|
||||||
_playerState.SendEvent("start_falling");
|
_playerState.SendEvent("start_falling");
|
||||||
}
|
}
|
||||||
|
public void HandleGroundedStanding(float delta)
|
||||||
|
{
|
||||||
|
CapsuleCollider.UndoCrouching(delta, 1);
|
||||||
|
HeadSystem.SetHeight(CapsuleCollider.GetCurrentHeight());
|
||||||
|
}
|
||||||
|
public void HandleGroundedCrouched(float delta)
|
||||||
|
{
|
||||||
|
CapsuleCollider.Crouch(delta, 1);
|
||||||
|
HeadSystem.SetHeight(CapsuleCollider.GetCurrentHeight());
|
||||||
|
}
|
||||||
public void HandleAirborne(float delta)
|
public void HandleAirborne(float delta)
|
||||||
{
|
{
|
||||||
if (isOnFloorCustom())
|
if (isOnFloorCustom())
|
||||||
|
@ -29,7 +29,7 @@ ProjectUISoundController="*res://addons/maaacks_game_template/base/scenes/autolo
|
|||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=1980
|
window/size/viewport_width=1920
|
||||||
window/size/viewport_height=1080
|
window/size/viewport_height=1080
|
||||||
|
|
||||||
[dotnet]
|
[dotnet]
|
||||||
|
@ -5,7 +5,7 @@ namespace Movementtests.systems;
|
|||||||
public partial class DashSystem: Node3D
|
public partial class DashSystem: Node3D
|
||||||
{
|
{
|
||||||
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
|
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
|
||||||
public float DashSpeed { get; set; } = 0.05f;
|
public float DashSpeed { get; set; } = 0.1f;
|
||||||
[Export(PropertyHint.Range, "0,1000,1,or_greater")]
|
[Export(PropertyHint.Range, "0,1000,1,or_greater")]
|
||||||
public float PostDashSpeed { get; set; } = 0f;
|
public float PostDashSpeed { get; set; } = 0f;
|
||||||
|
|
||||||
@ -27,12 +27,20 @@ public partial class DashSystem: Node3D
|
|||||||
|
|
||||||
private MantleSystem _mantleSystem;
|
private MantleSystem _mantleSystem;
|
||||||
private MeshInstance3D _dashTarget;
|
private MeshInstance3D _dashTarget;
|
||||||
|
private CpuParticles3D _dashIndicator;
|
||||||
|
private AnimationPlayer _dashIndicatorAnim;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public PackedScene DashIndicatorScene { get; set; }
|
||||||
|
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void DashStartedEventHandler();
|
public delegate void DashStartedEventHandler();
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void DashEndedEventHandler();
|
public delegate void DashEndedEventHandler();
|
||||||
|
[Signal]
|
||||||
|
public delegate void DashProgressEventHandler(float progress);
|
||||||
|
|
||||||
|
private Vector3 _globalDashPosition = Vector3.Zero;
|
||||||
|
|
||||||
public void Init(Node3D head, Camera3D camera, TweenQueueSystem tweenQueueSystem)
|
public void Init(Node3D head, Camera3D camera, TweenQueueSystem tweenQueueSystem)
|
||||||
{
|
{
|
||||||
@ -48,6 +56,8 @@ public partial class DashSystem: Node3D
|
|||||||
|
|
||||||
_dashTarget = GetNode<MeshInstance3D>("DashTarget");
|
_dashTarget = GetNode<MeshInstance3D>("DashTarget");
|
||||||
_dashTarget.SetVisible(false);
|
_dashTarget.SetVisible(false);
|
||||||
|
_dashIndicator = GetNode<CpuParticles3D>("DashIndicator");
|
||||||
|
_dashIndicatorAnim = GetNode<AnimationPlayer>("DashIndicator/AnimationPlayer");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ComputeDashLocation()
|
private void ComputeDashLocation()
|
||||||
@ -66,11 +76,16 @@ public partial class DashSystem: Node3D
|
|||||||
var fraction = _dashCast3D.GetClosestCollisionSafeFraction();
|
var fraction = _dashCast3D.GetClosestCollisionSafeFraction();
|
||||||
var globalSweepPath = TargetLocation - _dashCast3D.GlobalPosition;
|
var globalSweepPath = TargetLocation - _dashCast3D.GlobalPosition;
|
||||||
var locationAlongPath = _dashCast3D.GlobalPosition + globalSweepPath * fraction;
|
var locationAlongPath = _dashCast3D.GlobalPosition + globalSweepPath * fraction;
|
||||||
|
|
||||||
|
// Pushes the point down when dashing to under a platform so head doesn't clip
|
||||||
var maxPushDownDistance = 0.9f;
|
var maxPushDownDistance = 0.9f;
|
||||||
var correctionProportion = (float) Mathf.Remap(CollisionNormal.Y, -0.5, -1, 0, 1);
|
var correctionProportion = (float) Mathf.Remap(CollisionNormal.Y, -0.5, -1, 0, 1);
|
||||||
var proportion = (float) Mathf.Remap(_dashCast3D.GlobalRotation.X, 0, 1.57, 0, 1);
|
var proportion = (float) Mathf.Remap(_dashCast3D.GlobalRotation.X, 0, 1.57, 0, 1);
|
||||||
PlannedPlayerLocation = locationAlongPath + CollisionNormal * maxPushDownDistance * proportion * correctionProportion;
|
PlannedPlayerLocation = locationAlongPath
|
||||||
|
+ CollisionNormal
|
||||||
|
* maxPushDownDistance
|
||||||
|
* Mathf.Clamp(proportion, 0, 1)
|
||||||
|
* Mathf.Clamp(correctionProportion, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PrepareDash()
|
public void PrepareDash()
|
||||||
@ -88,7 +103,7 @@ public partial class DashSystem: Node3D
|
|||||||
var mantleLocation = Vector3.Zero;
|
var mantleLocation = Vector3.Zero;
|
||||||
if (HasHit && Mathf.Abs(CollisionNormal.Y) < 0.5f)
|
if (HasHit && Mathf.Abs(CollisionNormal.Y) < 0.5f)
|
||||||
{
|
{
|
||||||
var mantleResult = _mantleSystem.FindMantleLocationAtPoint(CollisionPoint, CollisionNormal);
|
var mantleResult = _mantleSystem.FindMantleLocationAtPoint(PlannedPlayerLocation, CollisionNormal);
|
||||||
ShouldMantle = mantleResult.IsSome(out mantleLocation);
|
ShouldMantle = mantleResult.IsSome(out mantleLocation);
|
||||||
}
|
}
|
||||||
PlannedMantleLocation = mantleLocation;
|
PlannedMantleLocation = mantleLocation;
|
||||||
@ -110,19 +125,36 @@ public partial class DashSystem: Node3D
|
|||||||
public void DashTweenEnded()
|
public void DashTweenEnded()
|
||||||
{
|
{
|
||||||
EmitSignal(SignalName.DashEnded);
|
EmitSignal(SignalName.DashEnded);
|
||||||
|
_dashTarget.SetVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dash()
|
public void Dash()
|
||||||
{
|
{
|
||||||
EmitSignal(SignalName.DashStarted);
|
EmitSignal(SignalName.DashStarted);
|
||||||
_dashTarget.SetVisible(false);
|
|
||||||
var dashTweenInputs = new TweenQueueSystem.TweenInputs(PlannedPlayerLocation, 0.1f);
|
var dashTweenInputs = new TweenQueueSystem.TweenInputs(PlannedPlayerLocation, DashSpeed);
|
||||||
var dashTween = _tweenQueueSystem.TweenToLocation(dashTweenInputs);
|
var dashTween = _tweenQueueSystem.TweenToLocation(dashTweenInputs);
|
||||||
|
// dashTween.SetTrans(Tween.TransitionType.Cubic);
|
||||||
|
// dashTween.SetEase(Tween.EaseType.Out);
|
||||||
|
dashTween.TweenMethod(Callable.From<float>(Dashing), 0.0f, 1.0f, DashSpeed);
|
||||||
dashTween.Finished += DashTweenEnded;
|
dashTween.Finished += DashTweenEnded;
|
||||||
if (ShouldMantle)
|
if (ShouldMantle)
|
||||||
{
|
{
|
||||||
_tweenQueueSystem.QueueTween(PlannedMantleLocation, 0.2f);
|
_tweenQueueSystem.QueueTween(PlannedMantleLocation, 0.2f);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// var dashIndicator = (CpuParticles3D) DashIndicatorScene.Instantiate();
|
||||||
|
// GetTree().GetRoot().AddChild(dashIndicator);
|
||||||
|
// _globalDashPosition = _dashTarget.GlobalPosition + 1.5f*Vector3.Up;
|
||||||
|
// dashIndicator.GlobalPosition = _globalDashPosition;
|
||||||
|
// dashIndicator.SetEmitting(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dashing(float proportion)
|
||||||
|
{
|
||||||
|
_dashTarget.SetGlobalPosition(_globalDashPosition);
|
||||||
|
EmitSignalDashProgress(proportion);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DashToThrownWeapon()
|
public void DashToThrownWeapon()
|
||||||
|
79
systems/dash/dash_indicator.tscn
Normal file
79
systems/dash/dash_indicator.tscn
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
[gd_scene load_steps=7 format=3 uid="uid://hd0868f4pb63"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://chvt6g0xn5c2m" path="res://systems/dash/light-ring.jpg" id="1_jadbb"]
|
||||||
|
|
||||||
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_tqt6i"]
|
||||||
|
transparency = 1
|
||||||
|
blend_mode = 1
|
||||||
|
shading_mode = 0
|
||||||
|
albedo_texture = ExtResource("1_jadbb")
|
||||||
|
billboard_mode = 1
|
||||||
|
|
||||||
|
[sub_resource type="PlaneMesh" id="PlaneMesh_jngg2"]
|
||||||
|
orientation = 2
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_fmn25"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:mesh:size")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(2, 2)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_stbcc"]
|
||||||
|
resource_name = "start"
|
||||||
|
length = 0.2
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath(".:mesh:size")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.2),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(2, 2), Vector2(0, 0)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "method"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath(".")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0.2),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"values": [{
|
||||||
|
"args": [],
|
||||||
|
"method": &"queue_free"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_3aile"]
|
||||||
|
_data = {
|
||||||
|
&"RESET": SubResource("Animation_fmn25"),
|
||||||
|
&"start": SubResource("Animation_stbcc")
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="DashIndicator" type="CPUParticles3D"]
|
||||||
|
material_override = SubResource("StandardMaterial3D_tqt6i")
|
||||||
|
emitting = false
|
||||||
|
amount = 1
|
||||||
|
lifetime = 0.5
|
||||||
|
one_shot = true
|
||||||
|
mesh = SubResource("PlaneMesh_jngg2")
|
||||||
|
gravity = Vector3(0, 0, 0)
|
||||||
|
|
||||||
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
libraries = {
|
||||||
|
&"": SubResource("AnimationLibrary_3aile")
|
||||||
|
}
|
||||||
|
autoplay = "start"
|
@ -1,8 +1,11 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://cqduhd4opgwvm"]
|
[gd_scene load_steps=8 format=3 uid="uid://cqduhd4opgwvm"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://dwoppk8j5fxeg" path="res://systems/dash/DashSystem.cs" id="1_hwig2"]
|
[ext_resource type="Script" uid="uid://dwoppk8j5fxeg" path="res://systems/dash/DashSystem.cs" id="1_hwig2"]
|
||||||
[ext_resource type="Shape3D" uid="uid://keseacdcooot" path="res://player_controller/resources/PlayerShape.tres" id="2_jngg2"]
|
[ext_resource type="Shape3D" uid="uid://keseacdcooot" path="res://player_controller/resources/PlayerShape.tres" id="2_jngg2"]
|
||||||
[ext_resource type="PackedScene" uid="uid://wq1okogkhc5l" path="res://systems/mantle/mantle_system.tscn" id="2_pff7b"]
|
[ext_resource type="PackedScene" uid="uid://wq1okogkhc5l" path="res://systems/mantle/mantle_system.tscn" id="2_pff7b"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://hd0868f4pb63" path="res://systems/dash/dash_indicator.tscn" id="2_tqt6i"]
|
||||||
|
|
||||||
|
[sub_resource type="SphereShape3D" id="SphereShape3D_jngg2"]
|
||||||
|
|
||||||
[sub_resource type="SphereMesh" id="SphereMesh_qu4wy"]
|
[sub_resource type="SphereMesh" id="SphereMesh_qu4wy"]
|
||||||
|
|
||||||
@ -10,6 +13,7 @@
|
|||||||
|
|
||||||
[node name="DashSystem" type="Node3D"]
|
[node name="DashSystem" type="Node3D"]
|
||||||
script = ExtResource("1_hwig2")
|
script = ExtResource("1_hwig2")
|
||||||
|
DashIndicatorScene = ExtResource("2_tqt6i")
|
||||||
|
|
||||||
[node name="PlayerShapeCast3D" type="ShapeCast3D" parent="."]
|
[node name="PlayerShapeCast3D" type="ShapeCast3D" parent="."]
|
||||||
shape = ExtResource("2_jngg2")
|
shape = ExtResource("2_jngg2")
|
||||||
@ -18,8 +22,8 @@ collision_mask = 2
|
|||||||
debug_shape_custom_color = Color(0.863327, 0.636844, 0, 1)
|
debug_shape_custom_color = Color(0.863327, 0.636844, 0, 1)
|
||||||
|
|
||||||
[node name="DashCast3D" type="ShapeCast3D" parent="."]
|
[node name="DashCast3D" type="ShapeCast3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.68, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.85, 0)
|
||||||
shape = ExtResource("2_jngg2")
|
shape = SubResource("SphereShape3D_jngg2")
|
||||||
target_position = Vector3(0, 0, -12)
|
target_position = Vector3(0, 0, -12)
|
||||||
max_results = 1
|
max_results = 1
|
||||||
collision_mask = 2
|
collision_mask = 2
|
||||||
@ -32,3 +36,6 @@ surface_material_override/0 = SubResource("StandardMaterial3D_v31n3")
|
|||||||
[node name="MantleSystem" parent="." instance=ExtResource("2_pff7b")]
|
[node name="MantleSystem" parent="." instance=ExtResource("2_pff7b")]
|
||||||
MantleEndLocationDistanceFromWall = 0.3
|
MantleEndLocationDistanceFromWall = 0.3
|
||||||
MantleHeightCastStart = 2.0
|
MantleHeightCastStart = 2.0
|
||||||
|
|
||||||
|
[node name="DashIndicator" parent="." instance=ExtResource("2_tqt6i")]
|
||||||
|
visible = false
|
||||||
|
5
systems/dash/dash_time_dilation.tres
Normal file
5
systems/dash/dash_time_dilation.tres
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[gd_resource type="Curve" format=3 uid="uid://c2a8soliruf35"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.5, 1), -1.89032e-07, -1.89032e-07, 0, 0, Vector2(0.8, 0.05), -9.56219, 0.0, 0, 1, Vector2(0.995, 0.05), 0.0, 0.0, 0, 0, Vector2(1, 1), -0.0540619, -0.0540619, 0, 0]
|
||||||
|
point_count = 5
|
BIN
systems/dash/light-ring.jpg
(Stored with Git LFS)
Normal file
BIN
systems/dash/light-ring.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
36
systems/dash/light-ring.jpg.import
Normal file
36
systems/dash/light-ring.jpg.import
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://chvt6g0xn5c2m"
|
||||||
|
path.s3tc="res://.godot/imported/light-ring.jpg-c39549c041934663aceb7b7e60c47efb.s3tc.ctex"
|
||||||
|
path.etc2="res://.godot/imported/light-ring.jpg-c39549c041934663aceb7b7e60c47efb.etc2.ctex"
|
||||||
|
metadata={
|
||||||
|
"imported_formats": ["s3tc_bptc", "etc2_astc"],
|
||||||
|
"vram_texture": true
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://systems/dash/light-ring.jpg"
|
||||||
|
dest_files=["res://.godot/imported/light-ring.jpg-c39549c041934663aceb7b7e60c47efb.s3tc.ctex", "res://.godot/imported/light-ring.jpg-c39549c041934663aceb7b7e60c47efb.etc2.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=2
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=true
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=0
|
@ -34,4 +34,9 @@ public partial class HeadSystem : Node3D
|
|||||||
{
|
{
|
||||||
return GetGlobalTransform().Basis.Z;
|
return GetGlobalTransform().Basis.Z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetHeight(float height)
|
||||||
|
{
|
||||||
|
Position = new Vector3(Position.X, height, Position.Z);
|
||||||
|
}
|
||||||
}
|
}
|
@ -28,6 +28,7 @@ public partial class TweenQueueSystem : Node3D
|
|||||||
var (location, duration) = inputs;
|
var (location, duration) = inputs;
|
||||||
|
|
||||||
var tween = GetTree().CreateTween();
|
var tween = GetTree().CreateTween();
|
||||||
|
tween.SetParallel(true);
|
||||||
tween.TweenProperty(_tweenObject, "global_position", location, duration);
|
tween.TweenProperty(_tweenObject, "global_position", location, duration);
|
||||||
tween.TweenCallback(_tweenEndedCallback);
|
tween.TweenCallback(_tweenEndedCallback);
|
||||||
_isTweening = true;
|
_isTweening = true;
|
||||||
|
Reference in New Issue
Block a user