//Move the character to the specified position and stops them there.
    public IEnumerator walkToAndStop(Vector2 pos, WaitPlatform platform)
    {
        myWaitPlatform = platform;

        //Stop automatic movement.
        autoWalk = false;

        while (true)
        {
            //Get the direction we need to move in.
            Vector2 direction = (pos - myRigidbody.position);

            //If we're already pretty much there.
            if (direction.magnitude < 0.1)
            {
                //Stop moving.
                myRigidbody.velocity = Vector2.zero;
                myAnimator.ResetTrigger("isWalking");
                myAnimator.SetTrigger("isIdle");
                break;
            }

            //Else, move towards that position at the speed of 2.
            myRigidbody.velocity = new Vector2(2 * direction.normalized.x, myRigidbody.velocity.y);

            yield return(new WaitForFixedUpdate());
        }

        yield return(null);
    }
    //Move the character to the specified position and stops them there.
    public IEnumerator walkToAndStop(Vector2 pos, WaitPlatform platform)
    {
        myWaitPlatform = platform;

        //Stop automatic movement.
        autoWalk = false;

        while (true)
        {
            //Get the direction we need to move in.
            Vector2 direction = (pos - myRigidbody.position);

            //If we're already pretty much there.
            if (direction.magnitude < 0.1)
            {
                //Stop moving.
                myRigidbody.velocity = Vector2.zero;
                myAnimator.ResetTrigger("isWalking");
                myAnimator.SetTrigger("isIdle");
                break;
            }

            //Else, move towards that position at the speed of 2.
            myRigidbody.velocity = new Vector2(2 * direction.normalized.x, myRigidbody.velocity.y);

            yield return new WaitForFixedUpdate();
        }

        yield return null;
    }