public void Attacked(float val) { effect.SetActive(true); DamageTextContoller.CreateDamageText(-val, transform); hp -= val; if (hp < 0) { isAlive = false; } }
private void Skill_Type_setDMG(GameObject target) { int a; int b; float c; if (skill_type == "ATTACK" || skill_type == "HEAL") { a = up_down == "UP" ? 1 : -1; b = ability_value; c = coefficient; float ms, ms1, ms2; float _as, _as1, _as2; float dmg_skill; ms1 = ((character.mag + (a * b)) * c) - target.GetComponent <Battle_Character>().rep; ms2 = 1; ms = ms1 > ms2 ? ms1 : ms2; _as1 = ((character.atk + (a * b)) * c) - target.GetComponent <Battle_Character>().def; _as2 = 1; _as = _as1 > _as2 ? _as1 : _as2; dmg_skill = _as + ms; dmg_skill *= (skill_type == "ATTACK" ? -1 : 1); target.GetComponent <Battle_Character>().hp += dmg_skill; DamageTextContoller.CreateDamageText(dmg_skill, target.transform); } else if (skill_type == "BUFF") { string e_a = effect_ability; b = up_down == "UP" ? 1 : -1; c = ability_value; if (e_a == "DEF") { target.GetComponent <Battle_Character>().def += b * c; } else if (e_a == "HP") { target.GetComponent <Battle_Character>().hp += b * c; DamageTextContoller.CreateDamageText(b * c, target.transform); } } else if (skill_type == "TOOL") { string e_a = effect_ability; a = up_down == "UP" ? 1 : -1; b = ability_value; if (e_a == "HP") { target.GetComponent <Battle_Character>().hp += a * b; } DamageTextContoller.CreateDamageText(a * b, target.transform); } }