void take_hit() { if (invincible) { return; } Transform trf; playerPower.minusHealth(1); // currentHealth--; if (currentHealth < 0) { return; } if (currentHealth == 0) { die(); return; } invincible = true; this.GetComponent <Animator>().SetTrigger("take_hit"); SpecialCamera.getSpecialCamera().screenShake_(0.25f); // trf = healthIconContainer.GetChild(currentHealth); // trf.GetComponent<Image>().color = HushPuppy.getColorWithOpacity(trf.GetComponent<Image>().color, 0.3f); }
void die() { Transform trf; SpecialCamera.getSpecialCamera().screenShake_(0.25f); SpecialCamera.getSpecialCamera().screenShake_(0.25f); SpecialCamera.getSpecialCamera().screenShake_(0.25f); restartButton.gameObject.SetActive(true); this.gameObject.SetActive(false); // trf = healthIconContainer.GetChild(currentHealth); // trf.GetComponent<Image>().color = HushPuppy.getColorWithOpacity(trf.GetComponent<Image>().color, 0.3f); }