0
\$\begingroup\$

I'm making a card game using photon and an important issue i am facing is getting reference of other player objects that are instantiated on the network.The Card game allows players to swap cards with other players However the player has the option to select which card and the players are seated in a fashion that allows your player to be in front of you like in Zynga's Texas Hold Em poker and i sucessfully managed to do that for 2 players by adding the conditions as follows But how do i manage for 4,6 or 8 players!

if (playerNumber == 0 && photonView.IsMine)
    {
        DisplayManager.instance.SetPlayer1(Obj_Name);
        DisplayManager.instance.SetPlayer1p(playerprofilepic);Debug.LogWarning("Profile Pic is " + playerprofilepic);
    }

    //server enemy plyer 
    if (playerNumber == 1 && !photonView.IsMine)
    {
        DisplayManager.instance.SetPlayer2(Obj_Name);
        DisplayManager.instance.SetPlayer2p(gameObject.GetComponent<CardGamePlayer>().playerprofilepic); Debug.LogWarning("Profile Pic is " + playerprofilepic);
    }

    //client my player  
    if (playerNumber == 1 && photonView.IsMine)
    {
        DisplayManager.instance.SetPlayer1(Obj_Name);
        DisplayManager.instance.SetPlayer1p(playerprofilepic); Debug.LogWarning("Profile Pic is " + playerprofilepic);
    }

    // enemy player
    if (playerNumber == 0 && !photonView.IsMine)
    {
        DisplayManager.instance.SetPlayer2(Obj_Name);
        DisplayManager.instance.SetPlayer2p(gameObject.GetComponent<CardGamePlayer>().playerprofilepic); Debug.LogWarning("Profile Pic is " + playerprofilepic);
    }
\$\endgroup\$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.