NavMeshAgent nav; // Reference to the nav mesh agent. void Awake() { // Set up the references. jugador = GameObject.FindGameObjectWithTag("Player").transform; saludJugador = jugador.GetComponent <SaludJugador> (); saludEnemigo = GetComponent <SaludEnemigo> (); nav = GetComponent <NavMeshAgent> (); }
float timer; // Timer for counting up to the next attack. void Awake() { // Setting up the references. player = GameObject.FindGameObjectWithTag("Player"); playerHealth = player.GetComponent <SaludJugador> (); enemyHealth = GetComponent <SaludEnemigo>(); anim = GetComponent <Animator> (); }