From 89c88b4e04425b990424adc40f9754f7731a8664 Mon Sep 17 00:00:00 2001 From: brausjonas Date: Sun, 16 Apr 2023 18:48:31 +0200 Subject: [PATCH] Fixed an animation bug --- .../.idea.FlufflParty/.idea/workspace.xml | 2 +- .../Scripts/Players/NoPlayablePlayer.cs | 12 ++++----- .../Assets/Scripts/Players/PlayablePlayer.cs | 26 ++++++++++++------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/FlufflParty/.idea/.idea.FlufflParty/.idea/workspace.xml b/FlufflParty/.idea/.idea.FlufflParty/.idea/workspace.xml index 16d7d8d..381f76c 100644 --- a/FlufflParty/.idea/.idea.FlufflParty/.idea/workspace.xml +++ b/FlufflParty/.idea/.idea.FlufflParty/.idea/workspace.xml @@ -171,7 +171,7 @@ - + diff --git a/FlufflParty/Assets/Scripts/Players/NoPlayablePlayer.cs b/FlufflParty/Assets/Scripts/Players/NoPlayablePlayer.cs index 6de26f4..f027e8f 100644 --- a/FlufflParty/Assets/Scripts/Players/NoPlayablePlayer.cs +++ b/FlufflParty/Assets/Scripts/Players/NoPlayablePlayer.cs @@ -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; diff --git a/FlufflParty/Assets/Scripts/Players/PlayablePlayer.cs b/FlufflParty/Assets/Scripts/Players/PlayablePlayer.cs index b21d274..206bc9a 100644 --- a/FlufflParty/Assets/Scripts/Players/PlayablePlayer.cs +++ b/FlufflParty/Assets/Scripts/Players/PlayablePlayer.cs @@ -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; + } } \ No newline at end of file