private void NewAnchorPlacementMessage(NetworkInMessage msg) { // TODO: Load New Anchor remoteAnchorName = CustomMessages2.Instance.ReadString(msg); DebugDisplay(string.Format(">>> NEW ANCHOR MESSAGE: {0}", remoteAnchorName)); ClearPlacementObjectAnchors(); CurrentState = AnchorManagementState.GetRemoteAnchor; }
private void AnchorStoreReady(UnityEngine.XR.WSA.Persistence.WorldAnchorStore store) { Debug.Log("WorldAnchorStore READY"); anchorStore = store; CurrentState = AnchorManagementState.AnchorStoreReady; if (!KeepRoomAlive) { anchorStore.Clear(); } }
private void MakeAnchorDataRequest() { if (storedAnchorString != null && roomManager.DownloadAnchor(currentRoom, storedAnchorString)) { CurrentState = AnchorManagementState.RemoteAnchorDataRequest; } else { Debug.LogError("Anchor Manager: Couldn't make the download request."); DebugDisplay(string.Format("\nCouldn't make the download request: {0}", storedAnchorString.GetString())); CurrentState = AnchorManagementState.RemoteAnchorAttachFailed; } }
private void RoomManagerListener_AnchorUploaded(bool successful, XString failureReason) { if (successful) { Debug.Log("Anchor Manager: Sucessfully Exported Local Anchor"); DebugDisplay("\nSucessfully Exported Local Anchor"); CurrentState = AnchorManagementState.LocalAnchorExported; // Notify other users of new uploaded anchor CustomMessages2.Instance.SendNewAnchorNotification(exportingAnchorName); } else { DebugDisplay(string.Format("\nAnchor Export failed " + failureReason)); Debug.LogError("Anchor Manager: Anchor Export failed " + failureReason); CurrentState = AnchorManagementState.LocalAnchorExportFailed; } }
private void ResetState() { #if UNITY_WSA && !UNITY_EDITOR IsLocalAnchor = false; IsAnchorConfigured = false; if (anchorStore != null) { CurrentState = AnchorManagementState.AnchorStoreReady; } else { // Re-Initialize CurrentState = AnchorManagementState.WaitingForAnchorStore; } #else CurrentState = AnchorManagementState.AnchorStoreReady; #endif }
void Start() { // Setup Anchor System remoteAnchorName = string.Empty; CurrentState = AnchorManagementState.WaitingForAnchorStore; UnityEngine.XR.WSA.Persistence.WorldAnchorStore.GetAsync(AnchorStoreReady); // Setup Message Handlers CustomMessages2.Instance.MessageHandlers[CustomMessages2.AppShareControlMessageID.NewAnchorPlacement] = NewAnchorPlacementMessage; // Setup Connection Immediately if available, otherwise handle as an event if (SharingStage.Instance.IsConnected) { SharingManagerConnected(); } else { SharingStage.Instance.SharingManagerConnected += SharingManagerConnected; } }
private void RoomManagerListener_AnchorsDownloaded(bool successful, AnchorDownloadRequest request, XString failureReason) { // If we downloaded anchor data successfully we should import the data. if (successful) { int datasize = request.GetDataSize(); Debug.LogFormat("Remote Anchor Download Size: {0} bytes.", datasize.ToString()); DebugDisplay(string.Format("\nRemote Anchor Download Size: {0} bytes.", datasize.ToString())); anchorDownloadRawBytes = new byte[datasize]; request.GetData(anchorDownloadRawBytes, datasize); CurrentState = AnchorManagementState.RemoteAnchorDataReady; } else { Debug.LogFormat("\nAnchor Download Failed " + failureReason); DebugDisplay(string.Format("\nAnchor Download Failed " + failureReason)); #if UNITY_WSA && !UNITY_EDITOR MakeAnchorDataRequest(); #endif } }
public void PlacementStart() { _previousTrackingState = _currentState; DebugDisplay(string.Format("Previouse State: {0}", _previousTrackingState.ToString())); CurrentState = AnchorManagementState.AnchorPlacementStart; }