如何在我的循环中创建一秒钟的暂停?

时间:2018-08-02 23:34:27

标签: c# unity3d game-engine

我正在编写一款塔防游戏,需要一颗子弹在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

    } 
  }

我应该做些什么功能或调整才能使其按我的方式工作?

0 个答案:

没有答案