예제 #1
0
    // 블루팀(2팀) 조인
    public void BlueTeamJoin(PhotonPlayer photonPlayer)
    {
        //플레이어가 이미 들어왔는데, 프리팹이 다시 생성되는걸 방지
        PlayerLeftRoom(photonPlayer);

        //플레이어 프리팹 생성, 리스트에 추가
        currentPlayer = Instantiate(playerListingPrefab);
        PlayerListing playerListing = currentPlayer.GetComponent <PlayerListing>();

        playerListing.PlayerNameTextChange(photonPlayer.NickName);
        playerListing.PhotonPlayer = photonPlayer;
        playerListings.Add(playerListing);

        // 플레이어 프리팹이 자리에 들어가므로 '비어있음'텍스트와 '참가'버튼을 끔
        foreach (Transform tr in team2ViewPort[team2Count].transform)
        {
            if (tr.name != "Line")
            {
                tr.gameObject.SetActive(false);
            }
        }

        playerListing.transform.SetParent(team2ViewPort[team2Count].transform, false);
        playerListing.transform.localPosition = Vector3.zero;

        team2Check[team2Count] = true;
        playerListing.viewnum  = team2Count;
        playerListing.Team     = 'b';

        team2Count++;
        photonPlayer.SetTeam(PunTeams.Team.blue);
    }