feat (slowdown): reduce the animation speed when in the slowdown area

This commit is contained in:
Pierre Ryssen
2026-05-01 22:04:56 +02:00
parent 94c28dca2f
commit 203f3e548b
2 changed files with 12 additions and 2 deletions

View File

@@ -14,9 +14,10 @@ public class PlayerMovement : MonoBehaviour
private Vector3 moveDirection;
// used for root enemies
// used by root enemies (area tell -> player do)
private float baseWalkSpeed;
private float slowMultiplier = 1f;
private float slowMultiplier = 1.0f;
private float animMultiplier = 1.0f;
private void Awake()
{
@@ -25,6 +26,7 @@ public class PlayerMovement : MonoBehaviour
animator = GetComponent<Animator>();
headController = GetComponent<PlayerHeadController>();
baseWalkSpeed = WalkSpeed;
animator.speed = 1.0f;
if (m_rigidbody != null)
{
@@ -37,6 +39,12 @@ public class PlayerMovement : MonoBehaviour
slowMultiplier = multiplier;
}
public void ApplyAnimationSlow(float multiplier)
{
animMultiplier = multiplier;
animator.speed = animMultiplier;
}
private void FixedUpdate()
{
Vector2 m_moveAmt = input.MoveAmount;