Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (!gameOver)
     {
         if (gameStart)
         {
             //Deciding who goes first
             if (!currentMover.diceRolled && !currentMover.playerRolledDice & !cam.flipping)
             {
                 if (!mobile)
                 {
                     SetMessage((currentMover.isBlack ? "Black: " : "White: ") + "Press space bar to roll 1 die");
                 }
                 else
                 {
                     SetMessage((currentMover.isBlack ? "Black: " : "White: ") + "Roll 1 die");
                 }
             }
             else
             {
                 SetMessage("");
             }
         }
         else if (currentMover.winner)
         {
             gameOver = true;
             AudioSource audioSource = GetComponent <AudioSource>();
             AudioClip   audioClip   = Resources.Load <AudioClip>("win");
             audioSource.PlayOneShot(audioClip);
             if (!mobile)
             {
                 SetMessage((currentMover.isBlack ? "Black " : "White ") + "wins!\nPress space bar to play again");
             }
             else
             {
                 SetMessage((currentMover.isBlack ? "Black " : "White ") + "wins!Play again?");
             }
             blackMover.SetActive(false);
             whiteMover.SetActive(false);
         }
         else if (currentMover.turnOver)
         {
             currentMover.GetComponentInChildren <MeshRenderer>().enabled = false;
         }
         else if (!currentMover.diceRolled && !currentMover.playerRolledDice && !cam.flipping && currentMover.myTurn)
         {
             if (!mobile)
             {
                 SetMessage((currentMover.isBlack ? "Black: " : "White: ") + "Press space bar to roll dice");
             }
             else
             {
                 SetMessage((currentMover.isBlack ? "Black: " : "White: ") + "Roll dice");
             }
             BlankDiceRollDisplays();
         }
         else
         {
             SetMessage("");
         }
     }
     else if (Input.GetKeyDown(KeyCode.Space))
     {
         SceneManager.LoadScene(SceneManager.GetActiveScene().name);
     }
 }