Exemplo n.º 1
0
    private IEnumerator MatchEnded()
    {
        yield return(new WaitForSeconds(2.5f));

        foreach (var player in _playersInMatch)
        {
            player.RpcTakeDamage(9999, null, "Match End");
        }
        _builder.CmdDestroyCurrentLevel();
        _matchInProgress = false;
        yield return(new WaitForSeconds(0.75f));

        RespawnTime = 3.5f; // TODO: COMMENT ME TO DEMO
        yield return(new WaitForSeconds(0.75f));

        foreach (var player in _playersInMatch)
        {
            Debug.Log(player.username + " isDead = " + player.isDead);
            if (player.isDead)
            {
                player.RpcRespawn();
                //StartCoroutine(player.Respawn());
            }
        }
        yield return(new WaitForSeconds(1f));

        RespawnTime = -1;
        //_builder.CmdDestroyCurrentLevel();
        _isRestarting = false;
        StartCoroutine(WaitForPlayers());

        //yield return new WaitForSeconds(50f);
    }