Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        game_variables_container = GameObject.Find("Game_variables");
        game_variables_list      = game_variables_container.GetComponentInChildren <game_variables_script> ();
        win_textbox = GameObject.Find("Title_winner").GetComponent <TextMeshProUGUI>();

        if (game_variables_list.get_who_win() == 0)
        {
            win_textbox.text = game_variables_list.get_player1_name() + " wins !";
        }
        else if (game_variables_list.get_who_win() == 1)
        {
            win_textbox.text = game_variables_list.get_player2_name() + " wins !";
        }
    }
Ejemplo n.º 2
0
 public void Roll()
 {
     if (current_player_moves == 0 && turn_edned == true)
     {
         current_player_moves           = Random.Range(1, 6);
         current_player_moves_text.text = current_player_moves.ToString();
         current_player_turns           = 1;
         current_player_turns_text.text = current_player_turns.ToString();
         roll_button.GetComponentInChildren <TextMeshProUGUI>().text = "End Turn";
         turn_edned = false;
     }
     else if (current_player_moves == 0 && turn_edned == false)
     {
         Is_it_game_over();
         turn_edned            = true;
         moved_already         = false;
         current_selected_pawn = -1;
         if (current_player_id == 0)
         {
             current_player_id++;
             current_player_id_text.text    = game_variables_list.get_player2_name();
             current_player_turns           = 0;
             current_player_moves_text.text = "";
             current_player_turns_text.text = "";
             for (int i = 0; i < player1_pawn_script_list.Length; i++)
             {
                 player1_pawn_script_list [i].reset_color();
             }
         }
         else
         {
             current_player_id--;
             current_player_id_text.text    = game_variables_list.get_player1_name();
             current_player_turns           = 0;
             current_player_moves_text.text = "";
             current_player_turns_text.text = "";
             for (int i = 0; i < player2_pawn_script_list.Length; i++)
             {
                 player2_pawn_script_list [i].reset_color();
             }
         }
         roll_button.GetComponentInChildren <TextMeshProUGUI>().text = "Roll";
     }
 }