using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class AgentInfo : MonoBehaviour { public string id; public string type; private NavMeshAgent navMeshAgent; private GameObject mainAgent; void Start() { id = "Agent_" + Random.Range(1000, 9999); type = Random.value > 0.5f ? "Friendly" : "Hostile"; navMeshAgent = GetComponent(); mainAgent = GameObject.FindGameObjectWithTag("MainAgent"); } void Update() { if (type == "Friendly" && mainAgent != null) { navMeshAgent.SetDestination(mainAgent.transform.position); } } void Desaparecer() { Destroy(gameObject); } }