Exemple #1
0
        /// <summary>
        /// Called when a remote player entered the room.
        /// See the official Photon docs for more details.
        /// </summary>
        public override void OnPhotonPlayerConnected(PhotonPlayer player)
        {
            //only let the master client handle this connection
            if (!PhotonNetwork.isMasterClient)
            {
                return;
            }

            //get the next team index which the player should belong to
            //assign it to the player and update player properties
            int teamIndex = GameManager.GetInstance().GetTeamFill(0);

            PhotonNetwork.room.AddSize(teamIndex, +1);
            player.SetTeam(teamIndex);

            //also player properties are not cleared when disconnecting and connecting
            //automatically, so we have to set all existing properties to null
            //these default values will get overriden by correct data soon
            player.Clear();

            //the master client sends an instruction to this player for adding him to the game
            this.photonView.RPC("AddPlayer", player);
            AddBullet();
            //**************
        }
Exemple #2
0
    void OnPhotonPlayerConnected(PhotonPlayer newPlayer)
    {
        //UpdateGenderCnt ();

        // TODO : 방에 새로 들어 온 유저 정보 업데이트
        //also player properties are not cleared when disconnecting and connecting
        //automatically, so we have to set all existing properties to null
        //these default values will get overriden by correct data soon
        newPlayer.Clear();
    }