Exemplo n.º 1
0
    /// <summary>
    /// 等待玩家发言完成,注意这是同时发言
    /// </summary>
    /// <returns>The for speech.</returns>
    /// <param name="players">检测的玩家.</param>
    /// <param name="facTime">发言时间.</param>
    /// <param name="checkTime">检查时间.</param>
    protected IEnumerator WaitForSpeech(List <uPomelos> players, float facTime, float checkTime = 1f)
    {
        float lastTime = 0f;

        for (float timer = 0f; timer < facTime; timer += Time.deltaTime)
        {
            if (timer - lastTime >= checkTime)
            {
                if (serverManager.CheckAllPlayerEndSpeech(players))
                {
                    break;
                }
                lastTime = timer;
            }
            yield return(null);
        }
    }