void OnTriggerEnter(Collider otro) { if (otro.CompareTag("Enemy")) { Debug.Log(otro); //deshabilitando el cubo; //otro.GetComponentInParent <Transform>().GetChild (3).gameObject.SetActive (false); //deshabilitando los ojos; otro.gameObject.SetActive(false); //obteniendo el animator; controladorAnimator = otro.gameObject.GetComponentInParent <ControladorAnimator> (); controladorAnimator.Morir(); } }
private void Awake() { //estas lineas son medio conflictivas para mí chaseState = new ChaseState(this); alertState = new AlertState(this); patrolState = new PatrolState(this); atackState = new AtackState(this); lookState = new LookState(this); //obteniendo el componente de navmesh navMeshAgent = GetComponent <NavMeshAgent> (); animator = GetComponent <Animator> (); controladorVision = GetComponent <ControladorVision> (); controladorNavMesh = GetComponent <ControladorNavMesh> (); controladorAnimator = GetComponent <ControladorAnimator> (); hashIDs = GetComponent <HashIDs> (); }