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