feat: time dilation and indicator

This commit is contained in:
2025-07-11 10:34:20 +02:00
parent e3d10840c9
commit 98b6537fdd
4 changed files with 67 additions and 7 deletions

View File

@ -37,6 +37,10 @@ public partial class DashSystem: Node3D
public delegate void DashStartedEventHandler();
[Signal]
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)
{
@ -121,14 +125,18 @@ public partial class DashSystem: Node3D
public void DashTweenEnded()
{
EmitSignal(SignalName.DashEnded);
_dashTarget.SetVisible(false);
}
public void Dash()
{
EmitSignal(SignalName.DashStarted);
_dashTarget.SetVisible(false);
var dashTweenInputs = new TweenQueueSystem.TweenInputs(PlannedPlayerLocation, DashSpeed);
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;
if (ShouldMantle)
{
@ -136,10 +144,17 @@ public partial class DashSystem: Node3D
return;
}
var dashIndicator = (CpuParticles3D) DashIndicatorScene.Instantiate();
GetTree().GetRoot().AddChild(dashIndicator);
dashIndicator.GlobalPosition = _dashTarget.GlobalPosition;
dashIndicator.SetEmitting(true);
// 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()