private void Start()
        {
            string[] errors;
            if (!DependenciesValid(out errors))
            {
                PrintValidationErrors(errors);
                gameObject.SetActive(false);
            }

#if WINDOWS_UWP
            try
            {
                OpenCVUtils.CheckOpenCVWrapperHasLoaded();
            }
            catch (System.Exception e)
            {
                Debug.LogError(e);
                gameObject.SetActive(false);
                return;
            }
#endif
            isHost = FindObjectOfType <PlatformSwitcher>().TargetPlatform == PlatformSwitcher.Platform.Hololens;

            // The host needs an aditional component
            if (isHost)
            {
                NetworkServer.RegisterHandler(MsgType.Connect, OnServerConnect);
                StartCoroutine(StartHostRoutine());
            }
            else
            {
                WorldSync.OnWorldSyncCompleteClient += OnWorldSync;
                NetworkServer.RegisterHandler(MsgType.Connect, OnClientConnect);
            }
        }
        private void Awake()
        {
            string[] errors;
            if (!DependenciesValid(out errors))
            {
                PrintValidationErrors(errors);
                gameObject.SetActive(false);
            }

#if WINDOWS_UWP
            try
            {
                OpenCVUtils.CheckOpenCVWrapperHasLoaded();
            }
            catch (System.Exception e)
            {
                Debug.LogError(e);
                gameObject.SetActive(false);
                return;
            }
#endif
            // 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 (!spectatorView.IsHost)
            {
                Invoke("ManualStart", 3f);
            }
        }
        private void Start()
        {
#if WINDOWS_UWP
            try
            {
                OpenCVUtils.CheckOpenCVWrapperHasLoaded();
            }
            catch (System.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;
            }
        }
示例#4
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
        }
示例#5
0
        private void Awake()
        {
#if WINDOWS_UWP
            try
            {
                OpenCVUtils.CheckOpenCVWrapperHasLoaded();
            }
            catch (System.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);
            }
        }