Slowing down some code execution

Here’s a question:

I have an enemy that can only move onto certain types of tiles on my game-grid. I want said enemy to check the surrounding tiles to see if any are of the right type, and move onto them randomly if they are the right type. I’ve got this part working. Problem is that the enemy moves psychotically fast, because it is running this code every time the Update function goes through. I want to slow this down a little, I know it involves Time.deltaTime, but I’m not sure how to implement. Here’s my current code with some experimentation with Time.deltaTime thrown in:

 e_rand = Random.Range(1, 4);
    timex = Time.deltaTime * 10;
    
if ((Physics.Raycast (transform.position - Vector3(0,10,0), Vector3.forward,hit,30)) (e_rand==1)  (timex > 10)){
		
		if (hit.transform.name != "mainman"){
    	controller.Move(Vector3(0, 0, -speed));}}


else if ((Physics.Raycast (transform.position - Vector3(0,10,0), Vector3.right,hit,30)) (e_rand==2)  (timex > 10)){
		if (hit.transform.name != "mainman"){
    	controller.Move(Vector3(speed, 0, 0));}}

else if ((Physics.Raycast (transform.position - Vector3(0,10,0), Vector3.left,hit,30)) (e_rand==3)  (timex > 10)){
		if (hit.transform.name != "mainman"){
    	controller.Move(Vector3(-speed, 0, 0));}}

else if ((Physics.Raycast (transform.position - Vector3(0,10,0), Vector3.back,hit,30)) (e_rand==4)  (timex > 10)){
		if (hit.transform.name != "mainman"){
    	controller.Move(Vector3(0, 0, speed));}}

Thanks ahead of time for any help folks.

You don’t actually need Time.deltaTime. What you want to do is set the next time to perform the action.

var nextMoveTime = 0.0;
var moveDelay = 0.05;

Update()
{
  if (... (What ever else you need to check) ...  (Time.time > nextMoveTime)){ 
    PerformMove();
    nextMoveTime = += moveDelay;
  }
}

thanks!