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

@@ -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);
}
}
}