void Awake() { navMeshagent = GetComponent <NavMeshAgent> (); viewSightCollider = GetComponentInChildren <SphereCollider> (); hp = GetComponentInChildren <HP_8> (); unitDetection = GetComponentInChildren <Unit1Detection_8>(); }
void Awake() { navMeshagent = GetComponent <NavMeshAgent> (); viewSightCollider = GetComponentInChildren <SphereCollider> (); hp = GetComponentInChildren <HP_8> (); unitDetection = GetComponentInChildren <Unit1Detection_10>(); goal = GameObject.FindGameObjectWithTag("Player2Nexus"); }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag != "Censor") { //부딪힌 대상이 타겟과 같으면 if (other.gameObject == target.gameObject) { HP_8 targetHP = other.gameObject.GetComponentInChildren <HP_8> (); if (targetHP != null) { targetHP.GetDamage(damage); } Destroy(this.gameObject); //this.gameObject.SetActive(false); } else { Destroy(this.gameObject, 2f); } } }