private NetworkConnection GetActiveConnection() { NetworkConnection connection = null; var stage = SharingStage.Instance; if (stage && stage.Manager != null) { connection = stage.Manager.GetServerConnection(); } if (connection == null || !connection.IsConnected()) { return(null); } return(connection); }
public void SendHeadTransform(Vector3 position, Quaternion rotation) { // If we are connected to a session, broadcast our head info if (serverConnection != null && serverConnection.IsConnected()) { // Create an outgoing network message to contain all the info we want to send NetworkOutMessage msg = CreateMessage((byte)TestMessageID.HeadTransform); AppendTransform(msg, position, rotation); // Send the message as a broadcast, which will cause the server to forward it to all other users in the session. serverConnection.Broadcast( msg, MessagePriority.Immediate, MessageReliability.UnreliableSequenced, MessageChannel.Avatar); } }