private void Awake() { tracker = Session.GetComponentInChildren <ImageTrackerFrameFilter>(); if (UseOfflineCache) { if (string.IsNullOrEmpty(OfflineCachePath)) { OfflineCachePath = Application.persistentDataPath + "/CloudRecognizerSample"; } if (!Directory.Exists(OfflineCachePath)) { Directory.CreateDirectory(OfflineCachePath); } if (Directory.Exists(OfflineCachePath)) { var targetFiles = Directory.GetFiles(OfflineCachePath); foreach (var file in targetFiles) { if (Path.GetExtension(file) == ".etd") { LoadOfflineTarget(file); } } } } }
private void Awake() { imageTracker = Session.GetComponentInChildren <ImageTrackerFrameFilter>(); cameraDevice = Session.GetComponentInChildren <VideoCameraDevice>(); // targets from scene controllerNamecard = GameObject.Find("ImageTarget-namecard").GetComponent <ImageTargetController>(); controllerIdback = GameObject.Find("ImageTarget-idback").GetComponent <ImageTargetController>(); imageTargetControllers[controllerNamecard] = false; imageTargetControllers[controllerIdback] = false; AddTargetControllerEvents(controllerNamecard); AddTargetControllerEvents(controllerIdback); CreateTargets(); var launcher = "AllSamplesLauncher"; if (Application.CanStreamedLevelBeLoaded(launcher)) { var button = BackButton.GetComponent <Button>(); button.onClick.AddListener(() => { UnityEngine.SceneManagement.SceneManager.LoadScene(launcher); }); } else { BackButton.gameObject.SetActive(false); } }
private void Awake() { imageTracker = Session.GetComponentInChildren <ImageTrackerFrameFilter>(); cameraDevice = Session.GetComponentInChildren <VideoCameraDevice>(); // targets from scene controllerNamecard = GameObject.Find("ImageTarget-namecard").GetComponent <ImageTargetController>(); controllerIdback = GameObject.Find("ImageTarget-idback").GetComponent <ImageTargetController>(); imageTargetControllers[controllerNamecard] = false; imageTargetControllers[controllerIdback] = false; AddTargetControllerEvents(controllerNamecard); AddTargetControllerEvents(controllerIdback); CreateTargets(); }
private void Awake() { tracker = Session.GetComponentInChildren <ImageTrackerFrameFilter>(); cloudRecognizer = Session.GetComponentInChildren <CloudRecognizerFrameFilter>(); if (UseOfflineCache) { if (string.IsNullOrEmpty(OfflineCachePath)) { OfflineCachePath = Application.persistentDataPath + "/CloudRecognizerSample"; } if (!Directory.Exists(OfflineCachePath)) { Directory.CreateDirectory(OfflineCachePath); } if (Directory.Exists(OfflineCachePath)) { var targetFiles = Directory.GetFiles(OfflineCachePath); foreach (var file in targetFiles) { if (Path.GetExtension(file) == ".etd") { LoadOfflineTarget(file); } } } } cloudRecognizer.CloudUpdate += (status, targets) => { if (cloudStatus != status) { Debug.LogFormat("Cloud status changed: {0} with {1} targets", status, targets.Count); cloudStatus = status; } foreach (var target in targets) { var uid = target.uid(); if (loadedCloudTargetUids.Contains(uid)) { continue; } LoadCloudTarget(target.Clone() as ImageTarget); } }; }
private void Awake() { tracker = Session.GetComponentInChildren <ImageTrackerFrameFilter>(); cloudRecognizer = Session.GetComponentInChildren <CloudRecognizerFrameFilter>(); if (UseOfflineCache) { if (string.IsNullOrEmpty(OfflineCachePath)) { OfflineCachePath = Application.persistentDataPath + "/CloudRecognizerSample"; } if (!Directory.Exists(OfflineCachePath)) { Directory.CreateDirectory(OfflineCachePath); } if (Directory.Exists(OfflineCachePath)) { var targetFiles = Directory.GetFiles(OfflineCachePath); foreach (var file in targetFiles) { if (Path.GetExtension(file) == ".etd") { LoadOfflineTarget(file); } } } } var launcher = "AllSamplesLauncher"; if (Application.CanStreamedLevelBeLoaded(launcher)) { var button = BackButton.GetComponent <Button>(); button.onClick.AddListener(() => { UnityEngine.SceneManagement.SceneManager.LoadScene(launcher); }); } else { BackButton.gameObject.SetActive(false); } }
private void Awake() { imageTracker = Session.GetComponentInChildren <ImageTrackerFrameFilter>(); cameraDevice = Session.GetComponentInChildren <VideoCameraDevice>(); int power = 1; // targets from scene foreach (ImageTargetController control in Resources.FindObjectsOfTypeAll(typeof(ImageTargetController))) { imageTargetControllers.Add(control, false); AddTargetControllerEvents(control); controllerMap.Add(control, (int)Math.Pow(2, power)); // set controller to a bit number (power of 2) power++; } // calculate combination bits for each combo of symbols that trigger an artifact foreach (TwoSymbolArtifactLink link in linkMap) { int bit1 = controllerMap[link.symbol1]; int bit2 = controllerMap[link.symbol2]; link.comboBit = bit1 | bit2; } }