void MovePlayer() { if (position == -1) { aIDestination.target = null; return; } if (!MainChar) { if (position != 1) { aIDestination.target = crewController.GetPositionTarget(position - 1); } aiPath.enabled = true; aiPath.maxSpeed = moveController.runSpeed * 1.25f; anim.SetBool("isRunning", !aiPath.reachedEndOfPath); if (aiPath.desiredVelocity.x >= 0.2f) { transform.localRotation = Quaternion.Euler(0, 180, 0); } else if (aiPath.desiredVelocity.x <= -0.2f) { transform.localRotation = Quaternion.Euler(0, 0, 0); } } else { aiPath.enabled = false; if (GetComponent <Rigidbody2D>().velocity.x >= 0.01f) { transform.localRotation = Quaternion.Euler(0, 180, 0); } else if (GetComponent <Rigidbody2D>().velocity.x <= -0.01f) { transform.localRotation = Quaternion.Euler(0, 0, 0); } anim.SetBool("isRunning", moveController.isRunning); } }