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
+1 -1
View File
@@ -171,7 +171,7 @@
<workItem from="1681479671396" duration="22217000" /> <workItem from="1681479671396" duration="22217000" />
<workItem from="1681565663292" duration="642000" /> <workItem from="1681565663292" duration="642000" />
<workItem from="1681648997302" duration="1618000" /> <workItem from="1681648997302" duration="1618000" />
<workItem from="1681659517327" duration="3062000" /> <workItem from="1681659517327" duration="4109000" />
</task> </task>
<servers /> <servers />
</component> </component>
@@ -51,17 +51,17 @@ public class NoPlayablePlayer : Player
private void Update() private void Update()
{ {
// //Animation Control //Animation Control
if (Vector3.Distance(transform.position, lastPosAnim) > 0f) if (jumpRequest)
{
animator.SetInteger("value", 1);
}
else if (jumpRequest)
{ {
jumpRequest = false; jumpRequest = false;
animator.SetInteger("value", 2); animator.SetInteger("value", 2);
lastTimeDoneIdleAction = Time.time; lastTimeDoneIdleAction = Time.time;
} }
else if (Vector3.Distance(transform.position, lastPosAnim) > 0)
{
animator.SetInteger("value", 1);
}
else if (Time.time - lastTimeDoneIdleAction > idleActionDelay) else if (Time.time - lastTimeDoneIdleAction > idleActionDelay)
{ {
lastTimeDoneIdleAction = Time.time; lastTimeDoneIdleAction = Time.time;
@@ -64,16 +64,16 @@ public class PlayablePlayer : Player
private void Update() private void Update()
{ {
//Animation Control //Animation Control
if (Vector3.Distance(transform.position, lastPosAnim) > 0) if (jumpRequest)
{
animator.SetInteger("value", 1);
}
else if (jumpRequest)
{ {
jumpRequest = false; jumpRequest = false;
animator.SetInteger("value", 2); animator.SetInteger("value", 2);
lastTimeDoneIdleAction = Time.time; lastTimeDoneIdleAction = Time.time;
} }
else if (Vector3.Distance(transform.position, lastPosAnim) > 0)
{
animator.SetInteger("value", 1);
}
else if (Time.time - lastTimeDoneIdleAction > idleActionDelay) else if (Time.time - lastTimeDoneIdleAction > idleActionDelay)
{ {
lastTimeDoneIdleAction = Time.time; lastTimeDoneIdleAction = Time.time;
@@ -109,7 +109,7 @@ public class PlayablePlayer : Player
jumpRequest = true; jumpRequest = true;
wurfelt = true; wurfelt = true;
wurfelZahl = Random.Range(2, 3); wurfelZahl = Random.Range(1, 7);
switch (activeItem) switch (activeItem)
{ {
@@ -290,15 +290,17 @@ public class PlayablePlayer : Player
{ {
if (fieldReturnStatus != 2 && fieldReturnStatus != 3) if (fieldReturnStatus != 2 && fieldReturnStatus != 3)
{ {
Invoke("Finish", 2); Invoke("Finish", 3);
} }
activated = false; activated = false;
} }
else else
{ {
checkDoubleDice = false; if (fieldReturnStatus != 2 && fieldReturnStatus != 3)
wurfelt = false; {
Invoke("RollDiceAgain", 3);
}
} }
} }
else else
@@ -480,4 +482,10 @@ public class PlayablePlayer : Player
client.SendStopRotator(rotatorStopIndex); client.SendStopRotator(rotatorStopIndex);
rotator.Stop(rotatorStopIndex); rotator.Stop(rotatorStopIndex);
} }
private void RollDiceAgain()
{
checkDoubleDice = false;
wurfelt = false;
}
} }