mantling after aimed dash with new mantle system
This commit is contained in:
@@ -228,7 +228,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
private float _playerHeight;
|
||||
private float _playerRadius;
|
||||
private bool _isJumpInputPressed = false;
|
||||
private bool _isJumpInputPressed;
|
||||
|
||||
private float _lookSensitivityMultiplier = 1.0f;
|
||||
private float _mouseSensitivityMultiplier = 1.0f;
|
||||
@@ -746,6 +746,9 @@ public partial class PlayerController : CharacterBody3D
|
||||
}
|
||||
|
||||
private Path _mantlePath;
|
||||
private bool _customMantle;
|
||||
private Transform3D _customMantleStartTransform;
|
||||
private Curve3D _customMantleCurve;
|
||||
public void OnMantleStarted()
|
||||
{
|
||||
HeadSystem.OnMantle();
|
||||
@@ -755,10 +758,12 @@ public partial class PlayerController : CharacterBody3D
|
||||
{
|
||||
GD.PrintErr("Failed to instantiate MantlePath");
|
||||
return;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var transform = _customMantle ? _customMantleStartTransform : MantleSystem.GlobalTransform;
|
||||
var curve = _customMantle ? _customMantleCurve : MantleSystem.MantleCurve;
|
||||
GetTree().GetRoot().AddChild(_mantlePath);
|
||||
_mantlePath.Setup(MantleSystem.GlobalTransform, MantleSystem.MantleCurve);
|
||||
_mantlePath.Setup(transform, curve);
|
||||
|
||||
var tween = GetTree().CreateTween();
|
||||
tween.SetTrans(Tween.TransitionType.Linear);
|
||||
@@ -771,15 +776,22 @@ public partial class PlayerController : CharacterBody3D
|
||||
{
|
||||
GlobalPosition = _mantlePath.Target.GlobalPosition;
|
||||
}
|
||||
|
||||
public void SimpleDash()
|
||||
{
|
||||
SetVelocity(GetInputGlobalHDirection() * SimpleDashStrength);
|
||||
}
|
||||
|
||||
public void MantleFinished()
|
||||
{
|
||||
_mantlePath.Teardown();
|
||||
var direction = GetInputGlobalHDirection();
|
||||
var direction = GetMoveInput();
|
||||
if (direction.Length() > 0)
|
||||
{
|
||||
SetVelocity(direction * SimpleDashStrength);
|
||||
SimpleDash();
|
||||
}
|
||||
|
||||
_customMantle = false;
|
||||
_playerState.SendEvent("grounded");
|
||||
}
|
||||
|
||||
@@ -1034,7 +1046,6 @@ public partial class PlayerController : CharacterBody3D
|
||||
}
|
||||
|
||||
private Vector3 _preDashVelocity = Vector3.Zero;
|
||||
|
||||
public void OnAimedDashStarted()
|
||||
{
|
||||
// Adjusting for player height, where the middle of the capsule should get to the dash location instead of the
|
||||
@@ -1048,9 +1059,10 @@ public partial class PlayerController : CharacterBody3D
|
||||
var dashTween = CreatePositionTween(correctedLocation, AimedDashTime);
|
||||
// dashTween.TweenMethod(Callable.From<float>(AimedDashTweenOngoing), 0.0f, 1.0f, AimedDashTime);
|
||||
dashTween.Finished += AimedDashTweenEnded;
|
||||
|
||||
_shouldMantleOnDashEnded = DashSystem.ShouldMantle;
|
||||
_mantleLocation = DashSystem.PlannedMantleLocation;
|
||||
|
||||
_customMantle = DashSystem.ShouldMantle;
|
||||
_customMantleCurve = DashSystem.MantleSystem.MantleCurve;
|
||||
_customMantleStartTransform = DashSystem.MantleSystem.GlobalTransform;
|
||||
}
|
||||
|
||||
Tween CreatePositionTween(Vector3 targetLocation, float tweenTime)
|
||||
@@ -1069,6 +1081,13 @@ public partial class PlayerController : CharacterBody3D
|
||||
_playerState.SendEvent("dash_finished");
|
||||
}
|
||||
|
||||
public void OnAimedDashFinished()
|
||||
{
|
||||
var postDashVelocity = _preDashVelocity.Length() > PostDashSpeed ? PostDashSpeed : _preDashVelocity.Length();
|
||||
Velocity = _dashDirection * postDashVelocity;
|
||||
if (_customMantle) _playerState.SendEvent("mantle");
|
||||
}
|
||||
|
||||
public void PlaceWeaponForTutorial()
|
||||
{
|
||||
if (TutorialDone)
|
||||
@@ -1107,29 +1126,12 @@ public partial class PlayerController : CharacterBody3D
|
||||
DashSystem.CollisionNormal);
|
||||
}
|
||||
|
||||
public void OnAimedDashFinished()
|
||||
{
|
||||
var postDashVelocity = _preDashVelocity.Length() > PostDashSpeed ? PostDashSpeed : _preDashVelocity.Length();
|
||||
Velocity = _dashDirection * postDashVelocity;
|
||||
|
||||
if (_shouldMantleOnDashEnded)
|
||||
{
|
||||
// TODO update post dash mantle
|
||||
// MantleToLocation(_mantleLocation);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSimpleDashStarted()
|
||||
{
|
||||
if (!_canDash)
|
||||
return;
|
||||
_canDash = false;
|
||||
|
||||
var dashStrength = SimpleDashStrength;
|
||||
|
||||
var direction = GetInputGlobalHDirection();
|
||||
SetVelocity(direction * dashStrength);
|
||||
SimpleDash();
|
||||
}
|
||||
|
||||
public void HandleSimpleDash(float delta)
|
||||
|
||||
Reference in New Issue
Block a user