extended enemy dashthrough improvement to aimed dash behaviour
This commit is contained in:
@@ -1782,20 +1782,32 @@ public partial class PlayerController : CharacterBody3D,
|
||||
// feet of the capsule
|
||||
var correction = DashSystem.CollisionNormal == Vector3.Down ? _playerHeight : DashSystem.DashCastRadius;
|
||||
var correctedLocation = DashSystem.PlannedLocation + Vector3.Down * correction;
|
||||
|
||||
var travel = correctedLocation - GlobalPosition;
|
||||
_dashDirection = travel.Normalized();
|
||||
|
||||
var shouldRebound = false;
|
||||
if (DashSystem.CanDashThroughTarget && DashSystem.CollidedObject is ITargetable targetable)
|
||||
correctedLocation = ComputePositionAfterTargetedDash(targetable.GetTargetGlobalPosition(), DashSystem.CollisionPoint);
|
||||
{
|
||||
var plannedDashLocation = targetable.GetTargetGlobalPosition() + Vector3.Down*_playerHeight/2;
|
||||
travel = plannedDashLocation - GlobalPosition;
|
||||
_dashDirection = travel.Normalized();
|
||||
var postDashLocation = plannedDashLocation + _dashDirection;
|
||||
var wallBehindQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition + Vector3.Up*HeadSystem.Position.Y, postDashLocation, GroundDetector.CollisionMask);
|
||||
var wallBehindResult = _spaceState.IntersectRay(wallBehindQuery);
|
||||
shouldRebound = wallBehindResult.Count > 0;
|
||||
correctedLocation = shouldRebound ? plannedDashLocation : postDashLocation;
|
||||
}
|
||||
|
||||
// Start invincibility timer for the duration of the dash and a bit more afterwards
|
||||
OnHitInvincibility();
|
||||
|
||||
_preDashVelocity = Velocity;
|
||||
_dashDirection = (correctedLocation - GlobalPosition).Normalized();
|
||||
SetupDashDamageDetector(correctedLocation);
|
||||
|
||||
var dashTween = CreatePositionTween(correctedLocation, AimedDashTime);
|
||||
// dashTween.TweenMethod(Callable.From<float>(AimedDashTweenOngoing), 0.0f, 1.0f, AimedDashTime);
|
||||
dashTween.Finished += AimedDashTweenEnded;
|
||||
if (shouldRebound) dashTween.Finished += ManualKnockback;
|
||||
|
||||
_customMantle = DashSystem.ShouldMantle;
|
||||
_customMantleCurve = DashSystem.MantleSystem.MantleCurve;
|
||||
@@ -2112,7 +2124,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
var travel = plannedDashLocation - GlobalPosition;
|
||||
_dashDirection = travel.Normalized();
|
||||
|
||||
var postDashLocation = plannedDashLocation + 0.5f*travel;
|
||||
var postDashLocation = plannedDashLocation + _dashDirection;
|
||||
var wallBehindQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition + Vector3.Up*HeadSystem.Position.Y, postDashLocation, GroundDetector.CollisionMask);
|
||||
var wallBehindResult = _spaceState.IntersectRay(wallBehindQuery);
|
||||
var shouldRebound = wallBehindResult.Count > 0;
|
||||
@@ -2122,6 +2134,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
if (isParry || shouldRebound) dashTween.Finished += OnDashParryEnded;
|
||||
else dashTween.Finished += OnDashAttackEnded;
|
||||
}
|
||||
|
||||
public void OnDashAttackStarted()
|
||||
{
|
||||
StartDashAction(isParry: false);
|
||||
@@ -2156,6 +2169,11 @@ public partial class PlayerController : CharacterBody3D,
|
||||
public void OnDashParryEnded()
|
||||
{
|
||||
StopDashAction();
|
||||
ManualKnockback();
|
||||
}
|
||||
|
||||
public void ManualKnockback()
|
||||
{
|
||||
Velocity = -_dashDirection*RKnockback.Modifier;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user