PhotonPlayer.Equals C# (CSharp) Method

Equals() public method

Makes PhotonPlayer comparable
public Equals ( object p ) : bool
p object
return bool
    public override bool Equals(object p)
    {
        PhotonPlayer pp = p as PhotonPlayer;
        return (pp != null && this.GetHashCode() == pp.GetHashCode());
    }

Usage Example

コード例 #1
0
    public void AskForPickupItemSpawnTimes()
    {
        if (this.IsWaitingForPickupInit)
        {
            if (PhotonNetworkManager.playerList.Length < 2)
            {
                Debug.Log("Cant ask anyone else for PickupItem spawn times.");
                this.IsWaitingForPickupInit = false;
                return;
            }


            // find a another player (than the master, who likely is gone) to ask for the PickupItem spawn times
            PhotonPlayer nextPlayer = PhotonNetworkManager.masterClient.GetNext();
            if (nextPlayer == null || nextPlayer.Equals(PhotonNetworkManager.player))
            {
                nextPlayer = PhotonNetworkManager.player.GetNext();
                //Debug.Log("This player is the Master's next. Asking this client's 'next' player: " + ((nextPlayer != null) ? nextPlayer.ToStringFull() : ""));
            }

            if (nextPlayer != null && !nextPlayer.Equals(PhotonNetworkManager.player))
            {
                this.photonView.RPC("RequestForPickupItems", nextPlayer);

                // you could restart this invoke and try to find another player after 4 seconds. but after a while it doesnt make a difference anymore
                //this.Invoke("AskForPickupItemSpawnTimes", 2.0f);
            }
            else
            {
                Debug.Log("No player left to ask");
                this.IsWaitingForPickupInit = false;
            }
        }
    }
All Usage Examples Of PhotonPlayer::Equals