dash indicators
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 12s
Create tag and build when new code gets to main / Export (push) Successful in 8m25s

This commit is contained in:
2025-10-17 16:53:23 +02:00
parent 417d9f5a6b
commit 70e3f70bcc
9 changed files with 307 additions and 39 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=43 format=3 uid="uid://bei4nhkf8lwdo"]
[gd_scene load_steps=45 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"]
@@ -44,6 +44,16 @@
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
height = 1.7
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nodcl"]
transparency = 1
albedo_color = Color(0, 0.627451, 0.6313726, 0.49019608)
[sub_resource type="CylinderMesh" id="CylinderMesh_nodcl"]
material = SubResource("StandardMaterial3D_nodcl")
top_radius = 0.2
bottom_radius = 0.2
height = 1.0
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_2q0ik"]
blend_mode = 1
@@ -128,8 +138,7 @@ MantleHeightCastStart = 1.5
[node name="Bobbing" type="Node3D" parent="."]
script = ExtResource("10_7wk1w")
BobbingFrequency = 3.0
BobbingAmplitude = 0.05
BobbingAmplitude = 0.0
[node name="FieldOfView" type="Node3D" parent="."]
script = ExtResource("12_m2mxi")
@@ -185,6 +194,12 @@ transform = Transform3D(1, 0, 0, 0, 0.173648, -0.984808, 0, 0.984808, 0.173648,
ThrowForce = 15.0
StraightThrowDuration = 0.05
[node name="DashIndicator" type="Node3D" parent="."]
[node name="DashIndicatorMesh" type="MeshInstance3D" parent="DashIndicator"]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, -1)
mesh = SubResource("CylinderMesh_nodcl")
[node name="DashCooldown" type="Timer" parent="."]
one_shot = true
@@ -202,7 +217,6 @@ offset_left = 1524.0
offset_top = 1.0
offset_right = -8.0
offset_bottom = 1.0
enabled = false
initial_node_to_watch = NodePath("../StateChart")
[node name="UI" type="CanvasLayer" parent="."]

View File

@@ -6,14 +6,6 @@ using Movementtests.systems;
using Movementtests.player_controller.Scripts;
using RustyOptions;
public enum JumpTypes
{
SimpleJump,
DoubleJump,
JumpFromDash,
JumpFromWall
}
public partial class PlayerController : CharacterBody3D
{
// User API to important child nodes.
@@ -33,6 +25,9 @@ public partial class PlayerController : CharacterBody3D
public PlayerUi PlayerUi;
public TextureRect DashIndicator;
public ColorRect PowerCooldownIndicator;
public Node3D DashIndicatorNode;
public MeshInstance3D DashIndicatorMesh;
public CylinderMesh DashIndicatorMeshCylinder;
private bool _movementEnabled = true;
@@ -217,6 +212,10 @@ public partial class PlayerController : CharacterBody3D
PowerCooldownIndicator.Visible = false;
EmpoweredActionsLeft = MaxNumberOfEmpoweredActions;
_targetSpeed = WalkSpeed;
DashIndicatorNode = GetNode<Node3D>("DashIndicator");
DashIndicatorMesh = GetNode<MeshInstance3D>("DashIndicator/DashIndicatorMesh");
DashIndicatorMeshCylinder = DashIndicatorMesh.Mesh as CylinderMesh;
DashIndicatorMesh.Visible = false;
// Node3D mapNode = GetTree().Root.FindChild("Map", true, false) as Node3D;
@@ -704,6 +703,8 @@ public partial class PlayerController : CharacterBody3D
}
DashSystem.StartPreparingDash();
DashIndicatorMesh.Visible = true;
if (!isOnFloorCustom())
ReduceTimeScaleWhileAiming();
}
@@ -711,12 +712,17 @@ public partial class PlayerController : CharacterBody3D
{
RotateWeaponWithPlayer();
DashIndicatorMeshCylinder.Height = DashSystem.PlannedLocation.DistanceTo(GlobalPosition);
DashIndicatorNode.LookAt(DashSystem.PlannedLocation);
if (CanPerformEmpoweredAction())
DashSystem.PrepareDash();
}
public void OnAimingExited()
{
DashSystem.StopPreparingDash();
DashIndicatorMesh.Visible = false;
}
public void DashToFlyingWeapon()
@@ -1078,6 +1084,20 @@ public partial class PlayerController : CharacterBody3D
LookAround();
CameraModifications((float) delta);
HandleStairs((float) delta);
if (WeaponSystem.InHandState.Active && !_aiming.Active)
{
DashIndicatorMesh.Visible = false;
}
if (!WeaponSystem.InHandState.Active)
{
DashIndicatorMesh.Visible = true;
DashIndicatorMeshCylinder.Height = WeaponSystem.GlobalPosition.DistanceTo(GlobalPosition) * 2;
DashIndicatorNode.LookAt(WeaponSystem.GlobalPosition);
}
}
}