Added a jump delay variation to each slime to make the jumps seem more natural
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user