// Update is called once per frame void Update() { whatNow = mapButton.GetMapNow(); for (int i = 0; i < map_id.Length; i++) { if (whatNow == i) { mapNameDisplay.text = map_name[i]; } } for (int i = 0; i < playerButton.Length; i++) { if (i == 0 || i == 1) { playerButton[i].GetAddButton().SetActive(false); } else { if (i < map_max_player[whatNow]) { if (!playerButton[i].GetAddButton().GetComponent <MenuUI>().GetAvalibleNow() && playerButton[i - 1].GetAddButton().GetComponent <MenuUI>().GetAvalibleNow()) { playerButton[i].GetAddButton().SetActive(true); } else { if (playerButton[i].GetAddButton().GetComponent <MenuUI>().GetAvalibleNow() && playerButton[i - 1].GetAddButton().GetComponent <MenuUI>().GetAvalibleNow()) { playerButton[i].GetAddButton().SetActive(true); } else { playerButton[i].GetAddButton().SetActive(false); } } if (i != 5) { if (playerButton[i].GetAddButton().GetComponent <MenuUI>().GetAvalibleNow() && playerButton[i + 1].GetAddButton().GetComponent <MenuUI>().GetAvalibleNow()) { playerButton[i].GetAddButton().SetActive(false); } } } else { playerButton[i].GetAddButton().GetComponent <MenuUI>().SetAvalibleNow(false); playerButton[i].GetAddButton().SetActive(false); } // && } playerAvalible[i] = playerButton[i].GetAddButton().GetComponent <MenuUI>().GetAvalibleNow(); playerTeam[i] = playerButton[i].GetTeam(); playerFaction[i] = playerButton[i].GetFaction(); } }