private void Start()
        {
#if WINDOWS_UWP
            try
            {
                OpenCVUtils.CheckOpenCVWrapperHasLoaded();
            }
            catch (Exception e)
            {
                Debug.LogError(e);
                gameObject.SetActive(false);
                return;
            }
#endif
            isHost = FindObjectOfType <PlatformSwitcher>().TargetPlatform == PlatformSwitcher.Platform.Hololens;
            // Auto find components if necessary
            if (NewDeviceDiscovery == null)
            {
                NewDeviceDiscovery = FindObjectOfType <NewDeviceDiscovery>();
            }

            if (SpectatorViewNetworkDiscovery == null)
            {
                SpectatorViewNetworkDiscovery = FindObjectOfType <SpectatorViewNetworkDiscovery>();
            }
            // The host needs an aditional component
            if (isHost)
            {
                if (MarkerDetectionHololens == null)
                {
                    MarkerDetectionHololens = FindObjectOfType <MarkerDetectionHololens>();
                }
                NetworkServer.Reset(); // Reset the server to make sure that it starts clean
                StartHost();
            }
            else
            {
                if (MarkerGeneration3D == null)
                {
                    MarkerGeneration3D = FindObjectOfType <MarkerGeneration3D>();
                }

                WorldSync.OnWorldSyncCompleteClient += OnWorldSync;
            }
        }
Пример #2
0
        private void Start()
        {
#if WINDOWS_UWP
            try
            {
                OpenCVUtils.CheckOpenCVWrapperHasLoaded();
            }
            catch (Exception e)
            {
                Debug.LogError(e);
                gameObject.SetActive(false);
                return;
            }

            detector = new MarkerDetector();
            detector.Initialize();

            holoLensCapture.OnFrameCapture += ProcessImage;
#endif
        }
Пример #3
0
        private void Awake()
        {
#if WINDOWS_UWP
            try
            {
                OpenCVUtils.CheckOpenCVWrapperHasLoaded();
            }
            catch (Exception e)
            {
                Debug.LogError(e);
                gameObject.SetActive(false);
                return;
            }
#endif
            isHost = FindObjectOfType <PlatformSwitcher>().TargetPlatform == PlatformSwitcher.Platform.Hololens;
            // The client doesn't have to wait for the server to be started, but this works best if the component
            // waits for the remaining networking bits to have warmed up,
            // just give it a couple of seconds and then start it
            if (!isHost)
            {
                Invoke("ManualStart", 4f);
            }
        }