// 공격 당했을 시 private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag.Equals("waterbullet") && Health > 0) { Health--; headAnimator.SetTrigger("hit"); wingsAnimator.SetTrigger("hit"); bodyAnimator.SetTrigger("hit"); flag = false; if (ThisName.Equals("enemy1")) { UIM.HitEnemy1(); } else if (ThisName.Equals("enemy2")) { UIM.HitEnemy2(); } waterball.SetActive(true); HitMessage.SetActive(true); if (Health > 0) { Invoke("SetFlagAndBall", 2f); } else { Invoke("SetFlagAndBall", 1.5f); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag.Equals("waterbullet") && Health != 0) { Health--; if (transform.tag.Equals("enemy1")) { UIM.HitEnemy1(); } else if (transform.tag.Equals("enemy2")) { UIM.HitEnemy2(); } waterball.SetActive(true); HitMessage.SetActive(true); flag = false; if (Health > 0) { Invoke("SetFlagAndBall", 2f); } else { Invoke("SetFlagAndBall", 1.5f); } } }