Player step SFX pitch change

This commit is contained in:
2026-02-03 22:15:02 -08:00
parent 35a625f636
commit affa5e1f79

View File

@@ -197,9 +197,10 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
HealthTimer.Stop();
}
public void TeleportPlayer(Transform3D newTransform)
public void TeleportPlayer((Vector3 Rotation, Vector3 Position) newTransform)
{
Transform = newTransform;
Rotation = newTransform.Rotation;
Position = newTransform.Position;
}
public void TakeDamage(AttackData damage)
@@ -351,6 +352,10 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
_knockbackStrength *= 0.9f;
Transform = Transform with { Basis = transform.Basis };
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
var rng = new RandomNumberGenerator();
rng.Randomize();
WalkSFX.PitchScale = rng.RandfRange(0.5f, 1.5f);
if (!WalkSFX.Playing && !Velocity.IsZeroApprox())
WalkSFX.Play();
else if (Velocity.IsZeroApprox())