AI waypoints and delay?.. need help

Hihi, i’m doing on a AI that moves to a waypoint and chooses if it wants to stay there for a few seconds. after that it will continue moving using the waypoints. i’m kinda stuck on the delay and checking for waypoints. can someone help me?

below is my codes. ps. sorry for my bad naming convention

`using UnityEngine;
using System.Collections;

public class AI_Way_Point_Movement : MonoBehaviour {

private int         currentWayPoint;
private float       timeWait = 0.0f;
int                 ranGenerator = 0;

float               speed = 10.0f;
bool                loop = true;



Vector3             target;
Vector3             moveDirection;
Vector3             velocity;
public Transform[]  wayPoint;

// Use this for initialization
void Start () 
{
    
}

void Awake()
{

}

// Update is called once per frame
void Update () 
{
    upDateWayPoint();
}

void upDateWayPoint()
{
    if (target.magnitude == 1 )
    {
        ranGenerator = Random.Range(0, 2);
        if (ranGenerator == 0)
        {
            NextWayPoint();
        }
        else
            if (ranGenerator == 1)
            {
                StayWayPoint();
            }
    }
      

}

void NextWayPoint()
{
    if (currentWayPoint < wayPoint.Length)
    {
        target = wayPoint[currentWayPoint].position;
        moveDirection = target - transform.position;

        velocity = rigidbody.velocity;
        if (moveDirection.magnitude < 1)
        {
            currentWayPoint++;
        }
        else
        {
            velocity = moveDirection.normalized * speed;
        }
    }
    else
    {
        if (loop)
        {
            currentWayPoint = 0;
        }
        else
        {
            velocity = Vector3.zero;
        }
    }

    rigidbody.velocity = velocity;
    transform.LookAt(target);
}   

//
void StayWayPoint()
{
    float randomGen = Random.Range(0.5f, 1.0f);
    timeWait = randomGen;
    if (timeWait != 0)
    {
        timeWait -= Time.smoothDeltaTime;
        speed = 0.0f;
    }
    else
    {
        speed = 10.0f;
    }
    
}

}
`

//heres a very simple example of a waypoint finder that had delay.

    // works if you name your waypoints waypoint1,waypoint2,waypoint3 ect.

var timer : float;
var waypoint : Gameobject;
var randvalue : int;
     function Update (){
          if(waypoint && transform.position != waypoint.transform.position){
    //script that moves character to waypoint here
}
  else{
randvalue = Random.Range(1,10);
    waypoint = gameObject.Find("waypoint"+randvalue);
}
}

do u have it in C#??