Cómo hacer que el enemigo se quede quieto un tiempo especifico?

ElNovato - 05/12/2020 23:05
Cómo hacer que el enemigo se quede quieto un tiempo especifico? Este es mi código:

[CODE]using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
using UnityEngine.AI;

public class Target : MonoBehaviour
{
public float health = 100f;
public Image imagenBarraVida;
public Animator anim;
public float Muerto = 3f;
public GameObject Dormido;
public NavMeshAgent agent;
public GameObject Enemigo;
public float distance;

public void Sumarvida(float cantidad)
{
if (health > 0)
{
health += cantidad;
}
}

private void Start()
{
anim = GetComponent();
}

public void TakeDamage (float amount)
{
health -= amount;
if (health <= 0f)
{
Die();
Corre();
}

}
// Start is called before the first frame update
void Die()
{
anim.Play("Dormido");
agent.enabled = false;
agent.acceleration = 0;

}

void Corre()
{

anim.Play("Run");
agent.enabled = true;

}

// Update is called once per frame
void Update()
{
health = Mathf.Clamp(health, 0, 100);

imagenBarraVida.fillAmount = health / 100;

}
}[/CODE]