public void importData(SSRP_contextResponse response) { boss = PersistantManager.Instance; if (ContextCanvasGameObject != null) { context_controller = ContextCanvasGameObject.GetComponent <SSRP_context_element_controller>(); } if (context_controller != null) { context_controller.importData(response); } else { boss.hud.addText("context response import is not set to entity canvas"); } }
public void renderEntities() { if (contextEntityViewGameObject) { Vector3 pos = new Vector3(0f, 0f, 0f); // loop through list of Child data and generate their UI foreach (SSRP_contextResponse entityReponse in distanceSorted[0]) { GameObject data_MVC; data_MVC = (GameObject)Instantiate(contextEntityViewGameObject, pos, Quaternion.identity); //data_MVC.transform.SetParent(contextEntityViewGameObject.transform, false); prefabChildList.Add(data_MVC); SSRP_context_element_controller child_controller = data_MVC.GetComponent <SSRP_context_element_controller>(); child_controller.importData(entityReponse); } } }
void LoadDataSet() { boss = PersistantManager.Instance; //Vuforia.ImageTarget; boss.hud.addText("LoadDataSet"); ObjectTracker objectTracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); if (objectTracker == null) { boss.hud.addText("error : TrackerManager.Instance.GetTracker<ObjectTracker>() == null"); return; } DataSet dataSet = objectTracker.CreateDataSet(); if (dataSet.Load(dataSetName)) { objectTracker.Stop(); // stop tracker so that we can add new dataset if (!objectTracker.ActivateDataSet(dataSet)) { // Note: ImageTracker cannot have more than 100 total targets activated //Debug.Log("<color=yellow>Failed to Activate DataSet: " + dataSetName + "</color>"); boss.hud.addText("Failed to Activate DataSet: " + dataSetName); } if (!objectTracker.Start()) { //Debug.Log("<color=yellow>Tracker Failed to Start.</color>"); boss.hud.addText("Tracker Failed to Start. " + dataSetName); } int counter = 0; foreach (Trackable trackObj in dataSet.GetTrackables()) { Debug.Log("dataSet [" + dataSetName + "]:" + trackObj.Name); //boss.hud.addText(trackObj.Name); } foreach (SSRP_contextResponse cr in contextElement_currentList) { Debug.Log("cr:" + cr.marker_name); } IEnumerable <TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours(); foreach (TrackableBehaviour tb in tbs) { SSRP_contextResponse hit_response = null; if (contextElement_currentList != null) { foreach (SSRP_contextResponse cr in contextElement_currentList) { if (tb.TrackableName == cr.marker_name) { hit_response = cr; } } } if (hit_response != null && tb.name == "New Game Object") { //importData //SSRP_ContextElement el = // change generic name to include trackable name tb.gameObject.name = ++counter + ":DynamicImageTarget-" + tb.TrackableName; // add additional script components for trackable tb.gameObject.AddComponent <DefaultTrackableEventHandler>(); tb.gameObject.AddComponent <TurnOffBehaviour>(); if (augmentationObject != null) { // instantiate augmentation object and parent to trackable GameObject aug_anchor = (GameObject)GameObject.Instantiate(augmentationAnchor); aug_anchor.transform.SetParent(tb.gameObject.transform); aug_anchor.transform.localPosition = Vector3.zero; aug_anchor.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); aug_anchor.transform.localScale = new Vector3(0.275f, 0.275f, 0.275f); // instantiate augmentation object and parent to trackable GameObject aug_obj = (GameObject)GameObject.Instantiate(augmentationObject); aug_obj.transform.SetParent(aug_anchor.transform); aug_obj.transform.localPosition = new Vector3(0f, 1.75f, 0f); aug_obj.transform.localRotation = Quaternion.identity; aug_obj.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); SSRP_context_element_controller aug_obj_script = aug_obj.GetComponent <SSRP_context_element_controller>(); if (aug_obj_script != null) { aug_obj_script.importData(hit_response); } // */ aug_obj.gameObject.SetActive(true); } else { //Debug.Log("<color=yellow>Warning: No augmentation object specified for: " + tb.TrackableName + "</color>"); boss.hud.addText("No augmentation object specified for: " + tb.TrackableName); } } } } else { //Debug.LogError("<color=yellow>Failed to load dataset: '" + dataSetName + "'</color>"); boss.hud.addText("Failed to load dataset: '" + dataSetName + "'"); } }