Fixed an animation bug

This commit is contained in:
brausjonas
2023-04-16 18:48:31 +02:00
parent 98fce52072
commit 89c88b4e04
3 changed files with 24 additions and 16 deletions
@@ -51,17 +51,17 @@ public class NoPlayablePlayer : Player
private void Update()
{
// //Animation Control
if (Vector3.Distance(transform.position, lastPosAnim) > 0f)
{
animator.SetInteger("value", 1);
}
else if (jumpRequest)
//Animation Control
if (jumpRequest)
{
jumpRequest = false;
animator.SetInteger("value", 2);
lastTimeDoneIdleAction = Time.time;
}
else if (Vector3.Distance(transform.position, lastPosAnim) > 0)
{
animator.SetInteger("value", 1);
}
else if (Time.time - lastTimeDoneIdleAction > idleActionDelay)
{
lastTimeDoneIdleAction = Time.time;
@@ -64,16 +64,16 @@ public class PlayablePlayer : Player
private void Update()
{
//Animation Control
if (Vector3.Distance(transform.position, lastPosAnim) > 0)
{
animator.SetInteger("value", 1);
}
else if (jumpRequest)
if (jumpRequest)
{
jumpRequest = false;
animator.SetInteger("value", 2);
lastTimeDoneIdleAction = Time.time;
}
else if (Vector3.Distance(transform.position, lastPosAnim) > 0)
{
animator.SetInteger("value", 1);
}
else if (Time.time - lastTimeDoneIdleAction > idleActionDelay)
{
lastTimeDoneIdleAction = Time.time;
@@ -109,7 +109,7 @@ public class PlayablePlayer : Player
jumpRequest = true;
wurfelt = true;
wurfelZahl = Random.Range(2, 3);
wurfelZahl = Random.Range(1, 7);
switch (activeItem)
{
@@ -290,15 +290,17 @@ public class PlayablePlayer : Player
{
if (fieldReturnStatus != 2 && fieldReturnStatus != 3)
{
Invoke("Finish", 2);
Invoke("Finish", 3);
}
activated = false;
}
else
{
checkDoubleDice = false;
wurfelt = false;
if (fieldReturnStatus != 2 && fieldReturnStatus != 3)
{
Invoke("RollDiceAgain", 3);
}
}
}
else
@@ -480,4 +482,10 @@ public class PlayablePlayer : Player
client.SendStopRotator(rotatorStopIndex);
rotator.Stop(rotatorStopIndex);
}
private void RollDiceAgain()
{
checkDoubleDice = false;
wurfelt = false;
}
}