// Have enemies walk to waypoints
    private void WalkToWaypoints()
    {
        // reached the last waypoint - lose condition
        if (waypointIndex >= waypoints.Count - 1)
        {
            Destroy(this.gameObject);
            uiScript.AllPlayersLose();
        }

        targetWaypoint = waypoints[waypointIndex].transform;
        //Debug.Log(waypointIndex);

        Vector2 dir = (Vector2)(targetWaypoint.position - transform.position);

        transform.Translate(dir.normalized * speed * Time.deltaTime, Space.World);

        float dist = Vector2.Distance(transform.position, targetWaypoint.position);

        if (dist <= Time.deltaTime * speed) // close enough to start moving on to next waypoint
        {
            transform.position = targetWaypoint.position;
            waypointIndex++;
        }
    }