void Awake() { navMeshagent = GetComponent <NavMeshAgent> (); viewSightCollider = GetComponentInChildren <SphereCollider> (); hp = GetComponentInChildren <HP_A> (); unitDetection = GetComponentInChildren <Unit1Detection_A>(); goal = GameObject.FindGameObjectWithTag("Player2Nexus"); }
void Awake() { navMeshagent = GetComponent <NavMeshAgent> (); viewSightCollider = GetComponentInChildren <SphereCollider> (); hp = GetComponentInChildren <HP_A> (); unitDetection = GetComponentInChildren <Unit2Detection_A>(); goal = GameObject.FindGameObjectWithTag("Player1Nexus"); anim = GetComponentInChildren <Animator> (); scoreManager = GameObject.Find("ScoreManager").GetComponent <ScoreManager_A>(); }
private void OnTriggerEnter(Collider other) { //1. 오직 해당 영역에 충돌한 주체가 적 유닛일 때만 엔딩 진행 if (other.gameObject.layer == 9) { HP_A otherHp = other.GetComponent <HP_A>(); nexus1.GetNexusDamage(); otherHp.currentHealth = 0; } else if (other.gameObject.layer == 8) { HP_A otherHp = other.GetComponent <HP_A>(); nexus2.GetNexusDamage(); otherHp.currentHealth = 0; //사라진 자리에 파티클 생성 } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag != "Censor") { //부딪힌 대상이 타겟과 같으면 if (other.gameObject == target.gameObject) { HP_A targetHP = other.gameObject.GetComponentInChildren <HP_A> (); if (targetHP != null) { targetHP.GetDamage(damage); } GameObject effectIns = (GameObject)Instantiate(impactEffect, transform.position, transform.rotation); Destroy(effectIns, 2f); Destroy(this.gameObject); //this.gameObject.SetActive(false); } else { Destroy(this.gameObject, 2f); } } }
void Awake() { viewSightCollider = GetComponentInChildren <SphereCollider> (); hp = GetComponentInChildren <HP_A> (); turretDetection = GetComponentInChildren <TurretDetection_A>(); }