예제 #1
0
    public void GotoChooseClassMenuAfterLoad(GameObject nameText)
    {
        playerName = nameText.GetComponent <LoadCurrentName>().text.text;
        Debug.Log("playerName = " + playerName);

        if (playerName.Equals(""))  //cannot load blank name
        {
            AudioManager.Play("Wait");
            Debug.Log("Cannot load Blank Name!!!");
        }

        /*else if (selectNameMenu.transform.parent.parent.GetComponent<CSSTopMenuScript>().NameIsTaken(playerName,playerNum))
         * {
         *  AudioManager.Play("Wait");
         *  Debug.Log("Name is already taken!");
         * }*/
        else if (MenuInputSelector.NameIsTaken(playerName, playerNum - 1))
        {
            AudioManager.Play("Wait");
            Debug.Log("Name is already taken!");
        }
        else
        {
            MenuInputSelector.PlayerNames[playerNum - 1]         = playerName; //set name chosen to global PlayerName variable
            MenuInputSelector.PlayerAssaultLevels[playerNum - 1] = LoadProfileList.GetAssaultLevel(playerName);
            MenuInputSelector.PlayerHeavyLevels[playerNum - 1]   = LoadProfileList.GetHeavyLevel(playerName);
            MenuInputSelector.PlayerShotgunLevels[playerNum - 1] = LoadProfileList.GetShotgunLevel(playerName);
            MenuInputSelector.PlayerSniperLevels[playerNum - 1]  = LoadProfileList.GetSniperLevel(playerName);
            previousMenu = selectNameMenu;
            GotoMenuHelper(chooseClassMenu);
            loadedName = true;
        }
    }
예제 #2
0
    public void JoinGame()
    {
        AudioManager.Play("Joined");
        joinScreen.SetActive(false);
        playerNumText.SetActive(true);
        Settings.NumOfPlayers = Settings.NumOfPlayers + 1;
        Debug.Log("numofplayers = " + Settings.NumOfPlayers);
        GotoMenuHelper(newGameOrLoadMenu);
        previousMenu = joinScreen;   //After player has joined, they will only be able to back up to "NewOrLoad" menu, going back anymore will cause the game to go back to MainMenu
        //newGameOrLoadMenu.SetActive(true);
        //currentMenu = newGameOrLoadMenu;
        //currentButton = 0;

        if (!MenuInputSelector.AllPlayersReady())
        {
            StartText.SetActive(false);
            SelectCharText.SetActive(true);
        }
    }
예제 #3
0
    public void GotoLevel()
    {
        //playerReadyScreen.transform.parent.parent.GetComponent<CSSTopMenuScript>().setPlayerReady(playerNum);

        //MenuInputSelector.PlayersReady[playerNum - 1] = true;

        //this.GetComponent<Image>().enabled = true;   //highlight "Ready" button

        if (MenuInputSelector.PlayersReady[playerNum - 1] == false)
        {
            AudioManager.Play("StartLevel");
            MenuInputSelector.PlayersReady[playerNum - 1] = true;
            GetComponent <Image>().enabled = true;
            if (MenuInputSelector.AllPlayersReady() == true)
            {
                Debug.Log("Got to ALLPLAYERSREADY check");
                StartText.SetActive(true);
                SelectCharText.SetActive(false);
            }
        }
        else
        {
            if (MenuInputSelector.AllPlayersReady())
            {
                //AudioManager.Play("StartLevel");
                //SceneManager.LoadScene("SampleScene");
                SceneManager.LoadScene("LoadingScreenScene");
                //SceneManager.LoadScene("SampleScene2");
            }
            else
            {
                AudioManager.Play("Back"); //Wait
                Debug.Log("Not all players are ready yet!!");
            }
        }
    }