Ejemplo n.º 1
0
 private void Update()
 {
     if (networked && !isLeaving && PhotonNetwork.IsConnected && PhotonNetwork.PlayerList.Length != 2)
     {
         isLeaving = true;
         NetworkRoom.LeaveRoom();
         SceneManager.LoadScene("PhotonPrototyping");
     }
 }
Ejemplo n.º 2
0
    //Called on SERVER when new client connects, player prefab instantiated
    public override void OnServerAddPlayer(NetworkConnection conn)
    {
        //if in menu scene, spawn in room player prefab and add as client
        //TODO: Only spawn in lobby scene, maybe use a sprite as a temporary placeholder for the characters
        //TODO: Sprites of different assigned colours depending on order of joining, different designated spawn points
        //TODO: What happens when disconnect? Do they retain the same order
        if (SceneManager.GetActiveScene().path == menuScene)
        {
            //If there were no room players prior, then this client is the leader
            bool isLeader = RoomPlayers.Count == 0;

            NetworkRoom roomPlayerInstance = Instantiate(roomPlayerPrefab); //Create an instance of network room instantiate room player prefab

            roomPlayerInstance.IsLeader = isLeader;                         //if we are the leader, then set is leader property to true (show start game btn)

            //So server knows that game object represents us with this connection ID
            NetworkServer.AddPlayerForConnection(conn, roomPlayerInstance.gameObject);
        }
    }
Ejemplo n.º 3
0
    public void answer()
    {
        NetworkRoom other = (NetworkRoom)networkRoom.GetComponent(typeof(NetworkRoom));

        if (other.intentos == 0)
        {
            if (status && !body.Equals(""))
            {
                other.emitResponse("correcto");
                other.intentos++;
                parent.GetComponent <Image>().color = Color.green;
            }
            else if (!body.Equals(""))
            {
                other.intentos++;
                other.emitResponse("incorrecto");
                parent.GetComponent <Image>().color = Color.red;
            }
        }
        else
        {
            Debug.Log("se acabaron los intentos");
        }
    }
 public static GameObject CreateJoinPublicRoomEntryCoffee(NetworkRoom roomData)
 {
     return(CreateJoinPublicRoomEntryCoffee(roomData.Name, roomData.Description, roomData.IsNSFW, roomData.GUID));
 }
 public static GameObject CreateJoinPrivateRoomEntryFellini(NetworkRoom roomData)
 {
     return(CreateJoinPrivateRoomEntryFellini(roomData.Name, roomData.Description, roomData.Code, roomData.IsNSFW, roomData.GUID));
 }