Player step SFX pitch change
This commit is contained in:
@@ -197,9 +197,10 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
|||||||
HealthTimer.Stop();
|
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)
|
public void TakeDamage(AttackData damage)
|
||||||
@@ -351,6 +352,10 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
|||||||
_knockbackStrength *= 0.9f;
|
_knockbackStrength *= 0.9f;
|
||||||
Transform = Transform with { Basis = transform.Basis };
|
Transform = Transform with { Basis = transform.Basis };
|
||||||
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
|
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
|
||||||
|
var rng = new RandomNumberGenerator();
|
||||||
|
rng.Randomize();
|
||||||
|
|
||||||
|
WalkSFX.PitchScale = rng.RandfRange(0.5f, 1.5f);
|
||||||
if (!WalkSFX.Playing && !Velocity.IsZeroApprox())
|
if (!WalkSFX.Playing && !Velocity.IsZeroApprox())
|
||||||
WalkSFX.Play();
|
WalkSFX.Play();
|
||||||
else if (Velocity.IsZeroApprox())
|
else if (Velocity.IsZeroApprox())
|
||||||
|
|||||||
Reference in New Issue
Block a user