コード例 #1
0
    public void OnJoinedRoom()
    {
        Room currentRoom = PhotonNetwork.room;

        string mapName = currentRoom.GetMap();

        m_roomMap = m_mapDatabase.GetMapWithMapName(mapName);

        int gamemodeIndex = currentRoom.GetGamemode();

        m_currenGameMode = (Mode)gamemodeIndex;

        Debug.Log("Gamemode : " + m_currenGameMode);

        //Instantiate MasterCLients Player
        if (PhotonNetwork.isMasterClient)
        {
            Gamemode.AddPlayerToTeam(m_currenGameMode, PhotonNetwork.masterClient);
            NetworkEventHandler.SyncSpawnNode(PhotonNetwork.player.GetPlayerTeam(), PhotonNetwork.masterClient);
            m_pingroutine = StartCoroutine(SetPing());
        }

        SetPlayerCount();
        IsRoomFull();
        m_startInternalTimer = true;
    }
コード例 #2
0
    public void OnPhotonPlayerConnected(PhotonPlayer newPlayer)
    {
        //Only MasterClient start Event to create Player
        //newPlayer is the new joind Client
        if (PhotonNetwork.isMasterClient)
        {
            Gamemode.AddPlayerToTeam(m_currenGameMode, newPlayer);
            NetworkEventHandler.SyncSpawnNode(newPlayer.GetPlayerTeam(), newPlayer);
        }

        SetPlayerCount();
        IsRoomFull();
    }