예제 #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag != "Censor")
     { //부딪힌 대상이 타겟과 같으면
         if (other.gameObject == target.gameObject)
         {
             HP_C targetHP = other.gameObject.GetComponentInChildren <HP_C> ();
             if (targetHP != null)
             {
                 targetHP.GetDamage(damage);
             }
             if (impactEffect)
             {
                 GameObject effectIns = (GameObject)Instantiate(impactEffect, transform.position, transform.rotation);
                 Destroy(effectIns, 2f);
             }
             Destroy(this.gameObject);
             //this.gameObject.SetActive(false);
         }
         else
         {
             Destroy(this.gameObject, 2f);
         }
     }
 }
예제 #2
0
 void Awake()
 {
     navMeshagent      = GetComponent <NavMeshAgent> ();
     viewSightCollider = GetComponentInChildren <SphereCollider> ();
     hp            = GetComponentInChildren <HP_C> ();
     unitDetection = GetComponentInChildren <Unit1Detection_C>();
     goal          = GameObject.FindGameObjectWithTag("Player2Nexus");
     anim          = GetComponentInChildren <Animator> ();
     myAudio       = GetComponent <AudioSource>();
 }
예제 #3
0
 //포탑의 체력 증가
 public void PutTowerRHP()
 {
     if (fp >= 250)
     {
         HP_C turretHP_R = turretR.GetComponentInChildren <HP_C>();
         turretHP_R.SetHealth(500);
         fp -= 250;
     }
     else
     {
         MyDebug.Log("열의가 부족합니다.");
     }
 }
예제 #4
0
 //포탑의 체력 증가
 public void PutTowerLHP()
 {
     Debug.Log("GetTowerLHP");
     if (fp >= 250)
     {
         HP_C turretHP_L = turretL.hp;
         turretHP_L.SetHealth(500);
         fp -= 250;
     }
     else
     {
         MyDebug.Log("열의가 부족합니다.");
     }
 }
 private void OnTriggerEnter(Collider other)
 {
     //1. 오직 해당 영역에 충돌한 주체가 적 유닛일 때만 엔딩 진행
     if (other.gameObject.layer == 9)
     {
         HP_C otherHp = other.GetComponent <HP_C>();
         nexus1.GetNexusDamage();
         otherHp.currentHealth = 0;
     }
     else if (other.gameObject.layer == 8)
     {
         HP_C otherHp = other.GetComponent <HP_C>();
         nexus2.GetNexusDamage();
         otherHp.currentHealth = 0;
         //사라진 자리에 파티클 생성
     }
 }
예제 #6
0
 private void Start()
 {
     //터렛의 HP 스크립트에 접근해야 함
     HP_C turretHP_R = turretR.GetComponentInChildren <HP_C>();
 }