public void StartPvP() { Bp_matrix.Fill_Matrix(); Client.Init(); typeMessageOut = new TypeMessage { Game = "BPGAME", Gamemode = "PvP", Player = " ", Totalplayers = DropDown.totalplayers, Currentposx = " ", Currentposy = " ", Initmode = "TRUE", isAi = "FALSE" }; string messageToSend = JsonConvert.SerializeObject(typeMessageOut); Client.SendString(messageToSend); SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 2); }
public static void Astar() { Bp_matrix.Identify_Cell(); Debug.Log("SE LLAMARA UN A STAR A LA CASILLA I = " + Bp_matrix.cell_x.ToString() + " J = " + Bp_matrix.cell_y.ToString()); if (!StartGameBP.hasAi && Turns.current_turn == 1) { TypeMessage typeMessageOut; typeMessageOut = new TypeMessage { Game = "BPGAME", Gamemode = "PvP", Player = "1", Totalplayers = DropDown.totalplayers, Currentposx = Bp_matrix.cell_x.ToString(), Currentposy = Bp_matrix.cell_y.ToString(), Initmode = "FALSE", isAi = "FALSE" }; string messageToSend = JsonConvert.SerializeObject(typeMessageOut); Client.SendString(messageToSend); } else if (!StartGameBP.hasAi && Turns.current_turn == 2) { TypeMessage typeMessageOut; typeMessageOut = new TypeMessage { Game = "BPGAME", Gamemode = "PvP", Player = "2", Totalplayers = DropDown.totalplayers, Currentposx = Bp_matrix.cell_x.ToString(), Currentposy = Bp_matrix.cell_y.ToString(), Initmode = "FALSE", isAi = "FALSE" }; string messageToSend = JsonConvert.SerializeObject(typeMessageOut); Client.SendString(messageToSend); } else if (StartGameBP.hasAi && Turns.current_turn == 1 && !Turns.Ai_Astar) { TypeMessage typeMessageOut; typeMessageOut = new TypeMessage { Game = "BPGAME", Gamemode = "PvAi", Player = "1", Totalplayers = DropDown.totalplayers, Currentposx = Bp_matrix.cell_x.ToString(), Currentposy = Bp_matrix.cell_y.ToString(), Initmode = "FALSE", isAi = "FALSE" }; string messageToSend = JsonConvert.SerializeObject(typeMessageOut); Client.SendString(messageToSend); } else if (Turns.Ai_Astar) { Debug.Log("PEDI UN ASTAR PARA EL AI"); Turns.Ai_Astar = false; TypeMessage typeMessageOut; typeMessageOut = new TypeMessage { Game = "BPGAME", Gamemode = "PvAi", Player = " ", Totalplayers = DropDown.totalplayers, Currentposx = Bp_matrix.cell_x.ToString(), Currentposy = Bp_matrix.cell_y.ToString(), Initmode = "FALSE", isAi = "TRUE" }; string messageToSend = JsonConvert.SerializeObject(typeMessageOut); Client.SendString(messageToSend); } }