Commit 7ff2a895 authored by Markus Schlösser's avatar Markus Schlösser
Browse files

Fixed animation resets in player actor

parent 13f00fe6
......@@ -58,6 +58,14 @@ public class PlayerActor : MonoBehaviour {
private void Update() {
animator.SetBool("isRunning", movementRoutine != null);
if (inputProvider.PeekingPressed && movementRoutine == null) {
trackingPoint.transform.localPosition = Vector3.up * peekingDistance;
animator.SetBool("isPeeking", true);
} else {
trackingPoint.transform.localPosition = Vector3.zero;
animator.SetBool("isPeeking", false);
}
if (movementRoutine != null) return;
transform.position = tilemap.GetCellCenterWorld(tilemap.WorldToCell(transform.position));
......@@ -72,13 +80,6 @@ public class PlayerActor : MonoBehaviour {
} else {
movementRoutine = null;
}
animator.SetBool("isPeeking", inputProvider.PeekingPressed);
if (inputProvider.PeekingPressed) {
trackingPoint.transform.localPosition = Vector3.up * peekingDistance;
} else {
trackingPoint.transform.localPosition = Vector3.zero;
}
}
private void OnTriggerEnter2D(Collider2D other) {
......@@ -210,7 +211,6 @@ public class PlayerActor : MonoBehaviour {
break;
case OnWalkOverAction.MoveConvex:
// TODO: Add animation
cellPos += directionVec * 2 + downVec;
o = o.GetLeft();
route.Add(Rotate(directionOrientation, directionOrientation.GetLeft(), o, CONVEX_RADIUS, CONVEX_ANIMATION_TIME));
......@@ -390,6 +390,12 @@ public class PlayerActor : MonoBehaviour {
movementRoutine = null;
}
animator.SetBool("isFalling", false);
animator.SetBool("isRunning", false);
animator.SetBool("isPeeking", false);
animator.SetBool("shouldSlide", false);
animator.Play("Idle");
transform.position = startingPosition;
orientation = startingOrientation;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment