gd: state chart supports dashing. new greybox material

This commit is contained in:
2025-06-06 11:21:53 +02:00
parent 749f0638c5
commit bbcc3d0867
16 changed files with 139 additions and 37 deletions

View File

@ -21,6 +21,11 @@ public partial class DashSystem: Node3D
private DashResolve _dashResolve;
[Signal]
public delegate void DashStartedEventHandler();
[Signal]
public delegate void DashEndedEventHandler();
public void Init(Node3D head, Camera3D camera, TweenQueueSystem tweenQueueSystem)
{
_dashCast3D = GetNode<ShapeCast3D>("DashCast3D");
@ -82,13 +87,21 @@ public partial class DashSystem: Node3D
_dashTarget.SetVisible(false);
}
public void DashTweenEnded()
{
EmitSignal(SignalName.DashEnded);
}
public void Dash()
{
EmitSignal(SignalName.DashStarted);
_dashTarget.SetVisible(false);
_tweenQueueSystem.QueueTween(_dashResolve.DashLocation, 0.1f);
var dashTweenInputs = new TweenQueueSystem.TweenInputs(_dashResolve.DashLocation, 0.1f);
var dashTween = _tweenQueueSystem.TweenToLocation(dashTweenInputs);
dashTween.Finished += DashTweenEnded;
if (_dashResolve.EndWithMantle)
{
_tweenQueueSystem.QueueTween(_dashResolve.MantleLocation, 0.1f);
_tweenQueueSystem.QueueTween(_dashResolve.MantleLocation, 0.2f);
}
}
}

View File

@ -10,10 +10,12 @@ public partial class TweenQueueSystem : Node3D
private Queue<TweenInputs> _tweenInputs = new Queue<TweenInputs>();
private Node3D _tweenObject;
private bool _isTweening = false;
private Callable _tweenEndedCallback;
public void Init(Node3D tweenObject)
{
_tweenObject = tweenObject;
_tweenEndedCallback = new Callable(this, MethodName.EndTween);
}
public void EndTween()
@ -21,18 +23,15 @@ public partial class TweenQueueSystem : Node3D
_isTweening = false;
}
private void TweenToLocation(TweenInputs inputs)
public Tween TweenToLocation(TweenInputs inputs)
{
var (location, duration) = inputs;
var tween = GetTree().CreateTween();
var callback = new Callable(this, MethodName.EndTween);
tween.TweenProperty(_tweenObject, "position", location, duration);
tween.TweenCallback(callback);
tween.TweenCallback(_tweenEndedCallback);
_isTweening = true;
tween.Play();
return tween;
}
public void QueueTween(TweenInputs inputs)