嘿,随着时间的推移,我一直在处理这个问题--代码,我使用了很多在线资源,而且我反复尝试了很多次,但是它没有起作用,所以我来到这里。免责声明:我的目标在屈服时不会被破坏,它只会击中屈服,什么都不会发生。
if(CurrentStatus == Status.Burning && burning==false){
burning=true;
StartCoroutine (DamageOverTimeCoroutine(100, 5));
Debug.Log("what");
burning = false;
//CurrentStatus = Status.Empty;}
public IEnumerator DamageOverTimeCoroutine(float damageAmount, float duration){
float amountDamaged = 0;
float damagePerLoop = damageAmount / duration;
while (amountDamaged < damageAmount) {
int numInt = (int)Math.Ceiling(damagePerLoop);
enemyCurrentHealth -= numInt;
var clone = (GameObject) Instantiate(damageNumber, this.gameObject.transform.position, Quaternion.Euler(Vector3.zero));
clone.GetComponent<FloatingNumbers> ().damageNumber = numInt;
amountDamaged += damagePerLoop;
yield return null;
Debug.Log(amountDamaged);
}
if(amountDamaged>damageAmount){
//StopCoroutine(DamageOverTimeCoroutine());
}
CurrentStatus = Status.Empty;
burning=false;
}重申一下,它会造成损害,然后在收益率返回时退出,我已经将它从WaitSeconds中更改,只是为了看看它是否会以其他方式工作,它不会。我从没有在屈服之火后经历过调试。为什么会发生这种情况?
非常感谢,谢谢
发布于 2021-06-27 21:05:19
计算出,var克隆= (GameObject)实例化(damageNumber,this.gameObject.transform.position,Quaternion.Euler(Vector3.0));clone.GetComponent ().damageNumber = numInt;
线路短路,没有抛出错误。奇怪,但现在起作用了。谢谢你们的意见
https://stackoverflow.com/questions/68150016
复制相似问题