/// <summary> /// Updates the clue from the image. /// </summary> /// <param name="image">The tracked image.</param> /// <param name="state">The image state.</param> public void UpdateRiddleFromImage(ARTrackedImage image, RuntimeRiddleClueState state) { string imageName = image.referenceImage.name; RuntimeRiddle riddle = this.GetRiddleFromImage(imageName); if (riddle != null) { riddle.UpdatePrefab(image, state); } }
/// <summary> /// Spawned the prefab. /// </summary> /// <param name="image">The ar tracked image itself.</param> /// <param name="state">The state of the image.</param> public void UpdatePrefab(ARTrackedImage image, RuntimeRiddleClueState state) { if (state == RuntimeRiddleClueState.STATE_REMOVED) { if (this._preScannedObject != null) { GameObject.Destroy(this._preScannedObject.gameObject); this._preScannedObject = null; } return; } if (this.RiddleFound) { if (this._preScannedObject == null) { // tODO: Spawn a prefab for after the scan GameObject prefab = this._gameClue.ReferenceImageData.Prefab.gameObject; GameObject spawnedObject = GameObject.Instantiate(prefab); this._preScannedObject = spawnedObject.GetComponent <RiddleScannedComponent>(); this._preScannedObject.ParentRiddle = this; } GameObject _gameObject = this._preScannedObject.gameObject; _gameObject.transform.position = image.transform.position; _gameObject.transform.rotation = image.transform.rotation; return; } if (this._preScannedObject == null) { GameObject prefab = this._gameClue.ReferenceImageData.Prefab.gameObject; GameObject spawnedObject = GameObject.Instantiate(prefab); this._preScannedObject = spawnedObject.GetComponent <RiddleScannedComponent>(); this._preScannedObject.ParentRiddle = this; } GameObject gameObject = this._preScannedObject.gameObject; gameObject.transform.position = image.transform.position; gameObject.transform.rotation = image.transform.rotation; }
public void UpdateRiddleFromImage(ARTrackedImage image, RuntimeRiddleClueState state) { this._runtimeRiddleManager?.UpdateRiddleFromImage(image, state); }