Exemplo n.º 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;
        }
    }
Exemplo n.º 2
0
    private void setPlayerInfo(int playerIndex)
    {
        if (MenuInputSelector.PlayerClasses[playerIndex] == 0)        //if player1 is Assault class
        {
            gameObject.AddComponent <PlayerFast>();
            gameObject.GetComponent <Player>().shootPosition = transform.GetChild(1).transform;  //may have to change this per class
            playerLevel = LoadProfileList.GetAssaultLevel(MenuInputSelector.PlayerNames[playerIndex]);
        }
        else if (MenuInputSelector.PlayerClasses[playerIndex] == 1)   //if player1 is Heavy class
        {
            gameObject.AddComponent <PlayerHeavy>();
            gameObject.GetComponent <Player>().shootPosition = transform.GetChild(1).transform;  //may have to change this per class
            playerLevel = LoadProfileList.GetHeavyLevel(MenuInputSelector.PlayerNames[playerIndex]);
        }
        else if (MenuInputSelector.PlayerClasses[playerIndex] == 2)   //if player1 is Shotgun class
        {
            gameObject.AddComponent <PlayerShotgun>();
            gameObject.GetComponent <Player>().shootPosition = transform.GetChild(1).transform;  //may have to change this per class
            playerLevel = LoadProfileList.GetShotgunLevel(MenuInputSelector.PlayerNames[playerIndex]);
        }
        else if (MenuInputSelector.PlayerClasses[playerIndex] == 3)   //if player1 is Sniper class
        {
            gameObject.AddComponent <PlayerSniper>();
            gameObject.GetComponent <Player>().shootPosition = transform.GetChild(1).transform;  //may have to change this per class
            playerLevel = LoadProfileList.GetSniperLevel(MenuInputSelector.PlayerNames[playerIndex]);
        }


        //then
        gameObject.GetComponent <Player>().playerNumber = playerIndex + 1;                                 //set player number
        //gameObject.GetComponentInChildren<TextMesh>().text = "P" + (1) + " (Keyboard input)";
        gameObject.GetComponentInChildren <TextMesh>().text  = MenuInputSelector.PlayerNames[playerIndex]; //get player1 name
        gameObject.GetComponent <Player>().myControllerInput = MenuInputSelector.menuControl[playerIndex]; // set player input



        if (playerIndex == 0)
        {
            gameObject.GetComponent <Player>().myCamera = GameObject.FindWithTag("Camera1").GetComponent <Camera>();    //set player camera
        }
        else if (playerIndex == 1)
        {
            gameObject.GetComponent <Player>().myCamera = GameObject.FindWithTag("Camera2").GetComponent <Camera>();    //set player camera
        }
        else if (playerIndex == 2)
        {
            gameObject.GetComponent <Player>().myCamera = GameObject.FindWithTag("Camera3").GetComponent <Camera>();    //set player camera
        }
        else if (playerIndex == 3)
        {
            gameObject.GetComponent <Player>().myCamera = GameObject.FindWithTag("Camera4").GetComponent <Camera>();    //set player camera
        }
        SetCameraDistance(playerIndex);
        SetCrossHair();
        Debug.Log("Should have initialized Player" + (playerIndex + 1));
    }