feat (root enemies): entrave the jump of the player when in area
This commit is contained in:
@@ -9,14 +9,19 @@ public class SlowdownArea : MonoBehaviour
|
||||
public float timer;
|
||||
|
||||
private float baseSpeed;
|
||||
private float baseJump;
|
||||
private bool isInZone = false;
|
||||
private PlayerMovement player;
|
||||
private PlayerJump jump;
|
||||
|
||||
private void OnTriggerEnter(Collider area)
|
||||
{
|
||||
if (area.CompareTag("Player")){
|
||||
player = area.GetComponent<PlayerMovement>();
|
||||
jump = area.GetComponent<PlayerJump>();
|
||||
baseSpeed = player.WalkSpeed;
|
||||
baseJump = 5.0f;
|
||||
jump.JumpForce = 1.5f;
|
||||
isInZone = true;
|
||||
}
|
||||
}
|
||||
@@ -28,6 +33,7 @@ public class SlowdownArea : MonoBehaviour
|
||||
isInZone = false;
|
||||
timer = 0f;
|
||||
player.WalkSpeed = baseSpeed;
|
||||
jump.JumpForce = baseJump;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +47,5 @@ public class SlowdownArea : MonoBehaviour
|
||||
float t = Mathf.Clamp(timer * slowSpeed, 0f, 1f);
|
||||
float multiplicator = Mathf.Lerp(1f, maxSlow, t);
|
||||
player.WalkSpeed = baseSpeed * multiplicator;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user