Ejemplo n.º 1
0
    public void SetUpPlayer(NetPlayer ParentNetObject)
    {
        ParentPlayer = ParentNetObject;
        if (LocalPlayer == null && ParentPlayer.LocalPlayer != null)
        {
            LocalPlayer = ParentPlayer.LocalPlayer;
        }
        PV.RPC("RPC_UpdateLocalPlayer", RpcTarget.AllBuffered, ParentNetObject.GetComponent <PhotonView>().ViewID);

        gameObject.name = ParentPlayer.name.Split('#')[0];
        Code            = ParentPlayer.CodeNumbers;
        UpdateName(gameObject.name);
        PV.RPC("RPC_UpdateCode", RpcTarget.All, Code);
        TeamNum = ParentPlayer.GetTeamNum();
        transform.GetComponentInChildren <LookAtPostionFollow>().UnParent();
        PV.RPC("RPC_UpdateTeamNum", RpcTarget.All, TeamNum);
        //PV.RPC("RPC_SetUpPlayer", RpcTarget.AllBuffered);
        //SetTeamNum(TeamNum);

        if (DisplayName == "")
        {
            DisplayName = (string)PhotonNetwork.LocalPlayer.CustomProperties["DisplayName"];
        }
        TextName.text = DisplayName;
        if (LocalPlayer == ParentPlayer)
        {
            TextName.gameObject.SetActive(false);
        }
        if (LocalPlayer.GetTeamNum() != ParentPlayer.GetTeamNum())
        {
            TextName.gameObject.SetActive(false);
        }

        if (LocalPlayer != null && SetLocalPlayerCalled)
        {
            PlayerLocalSet = true;
            PV.RPC("RPC_UpdateLocalSet", RpcTarget.AllBuffered, PlayerLocalSet);
        }
    }