stunnable targets on hit
This commit is contained in:
@@ -19,15 +19,18 @@ public partial class CGroundedMovement : Node3D, IMoveable
|
||||
|
||||
var targetPlane = new Vector3(target.X, GlobalPosition.Y, target.Z);
|
||||
LookAt(targetPlane);
|
||||
float xAcc = (float) Mathf.Lerp(velocity.X, direction.X * RMovement.Speed, inputs.delta * RMovement.Acceleration);
|
||||
float zAcc = (float) Mathf.Lerp(velocity.Z, direction.Z * RMovement.Speed, inputs.delta * RMovement.Acceleration);
|
||||
|
||||
var targetXSpeed = inputs.IsStunned ? 0 : direction.X * RMovement.Speed;
|
||||
var targetZSpeed = inputs.IsStunned ? 0 : direction.Z * RMovement.Speed;
|
||||
float xAcc = (float) Mathf.Lerp(velocity.X, targetXSpeed, inputs.Delta * RMovement.Acceleration);
|
||||
float zAcc = (float) Mathf.Lerp(velocity.Z, targetZSpeed, inputs.Delta * RMovement.Acceleration);
|
||||
velocity.X = xAcc;
|
||||
velocity.Z = zAcc;
|
||||
|
||||
if (WallInFrontRayCast.IsColliding())
|
||||
if (WallInFrontRayCast.IsColliding() && !inputs.IsStunned)
|
||||
velocity.Y = RMovement.Speed;
|
||||
else if (!inputs.isOnFloor)
|
||||
velocity += inputs.gravity * (float)inputs.delta * RMovement.GravityModifier;
|
||||
else if (!inputs.IsOnFloor)
|
||||
velocity += inputs.Gravity * (float)inputs.Delta * RMovement.GravityModifier;
|
||||
|
||||
return velocity;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user