为什么'受伤'价值不同?
public int Health = 500;
public int Injured;
public int AtkDamage()
{
Random AtkRnd = new Random();
return Injured = AtkRnd.Next(0, 100);
}
public int RemainHP()
{
return Health -= Injured;
}
为什么'受伤'在' RemainHP'不同于受伤的'在AtkDamage',他们在同一个班级。非常感谢。(对不起英语不好)
答案 0 :(得分:0)
删除=
中的RemainHP
。现在它相当于
Health = Health - Injured;
return Health;
你想要
return Health - Injured