void MiddleSwitchingDirection()
    {
        if (!started)
        {
            return;
        }
        switchingDirectionState = SwitchingDirectionState.Middle;
        Vector2 reflection     = Vector2.Reflect(ball.transform.position - transform.position, transform.up);
        Vector2 targetPosition = (Vector2)ball.transform.position + reflection;

        RaycastHit2D hitBelow = Physics2D.Raycast(targetPosition, -transform.up, Mathf.Infinity, groundLayer);

        if (hitBelow)
        {
            rb.position  = targetPosition;
            sprite.flipX = !sprite.flipX;
        }
        else
        {
            RaycastHit2D hitAbove = Physics2D.Raycast(targetPosition, transform.up, Mathf.Infinity, groundLayer);
            if (!hitAbove)
            {
                Debug.LogError("Can't teleport - not hitting anywhere!");
            }
            else
            {
                targetPosition = hitAbove.point + hitAbove.normal * (-characterSize / 2);
                rb.position    = targetPosition;
                sprite.flipX   = !sprite.flipX;
            }
        }

        return;
    }
 void Awake()
 {
     shouldSwitchDirection   = false;
     switchingDirectionState = SwitchingDirectionState.Stop;
     rb           = GetComponent <Rigidbody2D>();
     sprite       = GetComponentInChildren <SpriteRenderer>();
     ac           = GetComponent <Animator>();
     touchingBall = false;
     Hide();
 }
 void StopSwitchingDirection()
 {
     switchingDirectionState = SwitchingDirectionState.Stop;
 }
 void StartSwitchingDirection()
 {
     ac.SetTrigger("SwitchBallSide");
     switchingDirectionState = SwitchingDirectionState.Start;
 }