Added a jump delay variation to each slime to make the jumps seem more natural

This commit is contained in:
finnchen123
2026-02-13 18:44:46 +01:00
parent 1e654c73e4
commit 8b95aab282

View File

@@ -20,6 +20,7 @@ namespace Assets.Scripts.InteractableObjects
Stopwatch jumpTimer;
bool followsPlayer;
Fight fight;
int jumpResetModifier;
// Start is called before the first frame update
void Start()
@@ -44,6 +45,7 @@ namespace Assets.Scripts.InteractableObjects
{
jumpTimer.Start();
isJumping = true;
jumpResetModifier = rand.Next(-500, 500);
Vector3 jumpVector;
if (followsPlayer)
{
@@ -57,7 +59,7 @@ namespace Assets.Scripts.InteractableObjects
}
gameObject.GetComponent<Rigidbody>().AddForce(jumpVector, ForceMode.Impulse);
}
if (jumpTimer.ElapsedMilliseconds >= 5000)
if (jumpTimer.ElapsedMilliseconds >= 5000 + jumpResetModifier)
{
jumpTimer.Reset();
isJumping = false;