feat (slowdown): reduce the animation speed when in the slowdown area
This commit is contained in:
@@ -32,6 +32,7 @@ public class SlowdownArea : MonoBehaviour
|
|||||||
isInZone = false;
|
isInZone = false;
|
||||||
timer = 0f;
|
timer = 0f;
|
||||||
player.ApplySlow(1f);
|
player.ApplySlow(1f);
|
||||||
|
player.ApplyAnimationSlow(1f);
|
||||||
jump.JumpForce = baseJump;
|
jump.JumpForce = baseJump;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,5 +47,6 @@ public class SlowdownArea : MonoBehaviour
|
|||||||
float t = Mathf.Clamp(timer * slowSpeed, 0f, 1f);
|
float t = Mathf.Clamp(timer * slowSpeed, 0f, 1f);
|
||||||
float multiplicator = Mathf.Lerp(1f, maxSlow, t);
|
float multiplicator = Mathf.Lerp(1f, maxSlow, t);
|
||||||
player.ApplySlow(multiplicator);
|
player.ApplySlow(multiplicator);
|
||||||
|
player.ApplyAnimationSlow(multiplicator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,9 +14,10 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
|
|
||||||
private Vector3 moveDirection;
|
private Vector3 moveDirection;
|
||||||
|
|
||||||
// used for root enemies
|
// used by root enemies (area tell -> player do)
|
||||||
private float baseWalkSpeed;
|
private float baseWalkSpeed;
|
||||||
private float slowMultiplier = 1f;
|
private float slowMultiplier = 1.0f;
|
||||||
|
private float animMultiplier = 1.0f;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
@@ -25,6 +26,7 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
animator = GetComponent<Animator>();
|
animator = GetComponent<Animator>();
|
||||||
headController = GetComponent<PlayerHeadController>();
|
headController = GetComponent<PlayerHeadController>();
|
||||||
baseWalkSpeed = WalkSpeed;
|
baseWalkSpeed = WalkSpeed;
|
||||||
|
animator.speed = 1.0f;
|
||||||
|
|
||||||
if (m_rigidbody != null)
|
if (m_rigidbody != null)
|
||||||
{
|
{
|
||||||
@@ -37,6 +39,12 @@ public class PlayerMovement : MonoBehaviour
|
|||||||
slowMultiplier = multiplier;
|
slowMultiplier = multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ApplyAnimationSlow(float multiplier)
|
||||||
|
{
|
||||||
|
animMultiplier = multiplier;
|
||||||
|
animator.speed = animMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
private void FixedUpdate()
|
private void FixedUpdate()
|
||||||
{
|
{
|
||||||
Vector2 m_moveAmt = input.MoveAmount;
|
Vector2 m_moveAmt = input.MoveAmount;
|
||||||
|
|||||||
Reference in New Issue
Block a user