我正在编写一款塔防游戏,需要一颗子弹在10秒内每秒造成一次伤害。
我的代码是这样的:
float damageduration = 10;
void Poison (float damageduration)
{
int x = 0;
while (damageduration > 0)
{
x++;
Damage(target);
damageduration--;
Debug.Log("Poisoned" + x);
//Some piece of code here to make the Loop stop for 1 sec
}
}
我应该做些什么功能或调整才能使其按我的方式工作?