Little Help with addition code for this script for waypoint for AI

I am using this script for AI movement but the object instantly turns to the direction of the next waypoint then when it reaches the current waypoint and as it is a tailship it doesn’t look right. I would also like to wait at the last waypoint before doing the loop again.

Im not using the last part of the script as its not needed.

thanks

using System.Collections.Generic;
using UnityEngine;

public class AIwayPiontcontroller : MonoBehaviour
{

    public GameObject[] waypoints;
    int current = 0;
    public float rotSpeed = 2.0f;
    public float speed;
    float WPradius = 1;


    // Update is called once per frame
    void Update()
    {
        if (Vector3.Distance(waypoints[current].transform.position, transform.position) < WPradius)
         {
            current++;
            if (current >= waypoints.Length)
            {

                current = 0;
            }
        }
        gameObject.transform.LookAt(waypoints[current].transform.position);
        transform.position = Vector3.MoveTowards(transform.position, waypoints[current].transform.position, Time.deltaTime * speed);
    }
    public void Move()
    {
        //gameObject.transform.LookAt(waypoints[current].transform.position);
        //gameObject.transform.position += gameObject.transform.forward * speed * Time.deltaTime;
    }
}

Waiting:

void Update()
    {
        if(waitingTime > 0f)
        {
                waitingTime -= Time.deltaTime;
                return;
        }
        if (Vector3.Distance(waypoints[current].transform.position, transform.position) < WPradius)
         {
            current++;
            if (current >= waypoints.Length)
            {
                waitingTime = 5f;
                current = 0;
            }
        }
        gameObject.transform.LookAt(waypoints[current].transform.position);
        transform.position = Vector3.MoveTowards(transform.position, waypoints[current].transform.position, Time.deltaTime * speed);
    }

About change of Direction… Thats complex. Do you want it to stop and slowly turn? Do you want it to take a smooth path (which would lead us to using splines)?

Thanks FlashMuller
I will give this script a try .

I would like it to take a smooth path without stopping at each waypoint, it will stop and wait when it returns to the dock .

Then its splines. You can e.g. check out Curvy in the Assetstore (which might be a little overkill though). Or look at this tutorial: Curves and Splines, a Unity C# Tutorial