private void OnCollisionEnter(Collision collision) { if (collision.transform.tag == "monster") { if (!isCollision) { heroInformation.baseCharacterInformation.SubtractionHP( collision.transform.GetComponent <MinionMonster>().miniMonster.basecharacterinformation.GetDamae()); Debug.Log(heroInformation.baseCharacterInformation.GetHP()); for (int i = 0; i < drawBar.GetSliderHListHPber().Count; i++) { if (heroInformation.baseCharacterInformation.IsDie(i)) { Destroy(drawBar.GetHHeadUpPosition(i)); Destroy(drawBar.GetHeroHPber(i)); Destroy(gameObject); drawBar.RemoveHeroList(i); } } isCollision = true; } } }
private void OnCollisionEnter(Collision collision) { if (collision.transform.tag == "monster") { if (!isCol) { heroInformation.baseCharacterInformation.SubtractionHP( collision.transform.GetComponent <MinionMonster>().miniMonster.basecharacterinformation.GetDamae()); Debug.Log(heroInformation.baseCharacterInformation.GetHP()); isCol = true; } if (heroInformation.baseCharacterInformation.IsDie()) { Destroy(drawBar.GetHHeadUpPosition()); Destroy(drawBar.GetHeroHPber()); Destroy(gameObject); } } }