Exemplo n.º 1
0
    private IEnumerator DelayedResetCoroutine(float seconds)
    {
        //Wait a frame cause unity
        yield return(null);

        MenuMan.updateRoundsText();

        //Isnt first round
        if (!(mintPlayer1Score == 0 && mintPlayer2Score == 0))
        {
            MenuMan.scoreBoardAnimation();
        }

        //STOP
        Player1.GetComponent <PlayerControls>().CurrentAction = PlayerControls.ActionType.Dead;
        Player2.GetComponent <PlayerControls>().CurrentAction = PlayerControls.ActionType.Dead;

        yield return(new WaitForSeconds(seconds));

        Player1.GetComponent <Rigidbody>().velocity        = new Vector3(0, 0, 0);
        Player2.GetComponent <Rigidbody>().velocity        = new Vector3(0, 0, 0);
        Player1.GetComponent <Rigidbody>().angularVelocity = new Vector3(0, 0, 0);
        Player2.GetComponent <Rigidbody>().angularVelocity = new Vector3(0, 0, 0);

        Player1.transform.position = new Vector3(-4, 0.5f, 0);
        Player2.transform.position = new Vector3(4, 0.5f, 0);

        Camera.main.GetComponent <CombatCam>().resetCamera();

        //Game and match point
        if (mintPlayer1Score == MenuMan.numRounds - 1 && mintPlayer2Score == MenuMan.numRounds - 1)
        {
            SoundMan.playMatchPoint();
            MenuMan.matchPointAnimation();
            yield return(new WaitForSeconds(2));
        }
        else if (mintPlayer1Score == MenuMan.numRounds - 1 || mintPlayer2Score == MenuMan.numRounds - 1)
        {
            SoundMan.playGamePoint();
            MenuMan.gamePointAnimation();
            yield return(new WaitForSeconds(1.75f));
        }


        //Announcer and text anim
        SoundMan.playReady();
        MenuMan.ReadyAnimation();
        yield return(new WaitForSeconds(1));

        SoundMan.playBegin();
        MenuMan.BeginAnimation();

        yield return(new WaitForSeconds(0.5f));

        //Give control after begin has been said
        Player1.GetComponent <PlayerControls>().CurrentAction = PlayerControls.ActionType.None;
        Player2.GetComponent <PlayerControls>().CurrentAction = PlayerControls.ActionType.None;

        Resetting = false;
    }