public void CommandBall()//called by the Ability istelf when button is pressed.
    {
        switch (currentState)
        {
        case LightningballallState.following:
            Debug.Log("Command given: Attack!");
            currentState = LightningballallState.attacking;
            // change state to attacking, then shoot out in direction of player facing
            var shootDir = new Vector2(pm.lastHoriz, pm.lastVert);
            rb.velocity = shootDir * 40;
            StartCoroutine(LookForEnemies());
            break;

        case LightningballallState.attacking:
            Debug.Log("Command given: Return");
            StopAllCoroutines();
            attacking   = false;
            firstTarget = false;
            finder.enemies.Clear();
            currentState = LightningballallState.returning;
            //change target to the player so that the ball zips back, then once within a certain distance set state to following
            break;

        case LightningballallState.returning:
            break;
        }
        finder.FinderOnOff();
    }
    void Update()
    {
        switch (currentState)
        {
        case LightningballallState.following:
            //max velocity
            if (rb.velocity.x > maxVelocity)
            {
                rb.velocity = new Vector2(maxVelocity, rb.velocity.y);
            }
            if (rb.velocity.y > maxVelocity)
            {
                rb.velocity = new Vector2(rb.velocity.x, maxVelocity);
            }
            //find distance to player and move until you are within a good range of it.
            playerDistance = (gameObject.transform.position - player.transform.position).magnitude;
            if (playerDistance >= (followDistance + followBuffer))
            {
                FollowPlayerMove();
                break;
            }
            if (playerDistance <= (followDistance - followBuffer))
            {
                BackAwayFromPlayer();
                break;
            }
            break;

        case LightningballallState.attacking:

            break;

        case LightningballallState.returning:
            playerDistance = (gameObject.transform.position - player.transform.position).magnitude;
            if (playerDistance >= (followDistance + followBuffer))
            {
                FollowPlayerMove();
                break;
            }
            if (playerDistance <= (followDistance - followBuffer))
            {
                rb.velocity  = Vector3.zero;
                currentState = LightningballallState.following;
                finder.FinderOnOff();
                break;
            }
            break;
        }
    }