Exemple #1
0
 public void ButtonIniciateGame()
 {
     if (tutorialScreen == false)
     {
         audioSystemScript.PlayTheSound(1);
         audioSystemScript.StopTheSound(0);
         StartCoroutine(MenuTimer(1));
     }
 }
Exemple #2
0
 public void AssociatePrimarySystemAudio()
 {
     audioSystemObj    = GameObject.FindWithTag("CameraListener");
     audioSystemScript = audioSystemObj.GetComponent <audioSystem>();
     if (actualSceneName == "Menu")
     {
         audioSystemScript.AssociateGameAudio();
         //play menu music
         audioSystemScript.PlayTheSound(0);
     }
     else if (actualSceneName == "Game")
     {
         audioSystemScript.AssociateGameAudio();
         //play ingame music
     }
     else if (actualSceneName == "VictoryScreen")
     {
         audioSystemScript.AssociateGameAudio();
     }
 }
    IEnumerator TimerOfRaceStart()
    {
        while (true)
        {
            yield return(new WaitForSeconds(1.0f));

            //3
            bothCameraScript.ResetOffset(posPlayerOne, posPlayerTwo);
            BothCameraTextObj.transform.DOScale(2.0f, 0.0f);
            BothCameraTextObj.transform.DOScale(1.0f, 1.0f);
            BothCameraText.text = "3";
            audioSystemScript.PlayTheSound(1);
            someoneBurned = false;
            yield return(new WaitForSeconds(1.0f));

            //2
            BothCameraTextObj.transform.DOScale(2.0f, 0.0f);
            BothCameraTextObj.transform.DOScale(1.0f, 1.0f);
            BothCameraText.text = "2";
            audioSystemScript.PlayTheSound(1);
            yield return(new WaitForSeconds(1.0f));

            //1
            BothCameraTextObj.transform.DOScale(2.0f, 0.0f);
            BothCameraTextObj.transform.DOScale(1.0f, 1.0f);
            BothCameraText.text = "1";
            audioSystemScript.PlayTheSound(1);
            //liberar player
            playerOneScript.playable = true;
            playerTwoScript.playable = true;
            yield return(new WaitForSeconds(1.0f));

            if (someoneBurned == true)
            {
                audioSystemScript.PlayTheSound(3);
                break;
            }
            else
            {
                //GO
                BothCameraText.text = "GO";
                audioSystemScript.PlayTheSound(2);
                audioSystemScript.PlayTheSound(0);
                playerOneScript.modeAceleration = 5.0f;
                playerTwoScript.modeAceleration = 5.0f;
                playerOneScript.canIniciate     = true;
                playerTwoScript.canIniciate     = true;
                MatchStart();
                yield return(new WaitForSeconds(0.2f));

                //pos iniciate
                playerOneScript.modeAceleration = playerOneScript.shipX;
                playerTwoScript.modeAceleration = playerTwoScript.shipX;
                //mudar velocidade \ true start
                yield return(new WaitForSeconds(0.3f));

                BothCameraText.text = "";
                break;
            }
        }
    }