dash indicators
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user