public static HotspotControllerSerialized SerializeController(HotspotController controller) { HotspotControllerSerialized serializedController = new HotspotControllerSerialized(); serializedController.hotspotsAndBatches = new HotspotControllerChildSerializable[controller.transform.childCount]; for (int i = 0; i < controller.transform.childCount; i++) { var child = controller.transform.GetChild(i); var batch = child.GetComponent <HotspotBatch>(); var hotspot = child.GetComponent <HotspotScript>(); //BATCH if (batch != null) { serializedController.hotspotsAndBatches[i] = SerializeHotspotBatch(batch); } //HOTSPOT else if (hotspot != null) { serializedController.hotspotsAndBatches[i] = SerializeHotspot(hotspot); } } return(serializedController); }
private void Awake() { StartCoroutine(stallAwake()); if (Instance == null) { Instance = this; } //get click, then "GetHoveredGameObject()", then do something //if (VusrInput.HoveredGameObject == cube1) //{ // // interact with gameobject // cube1.SetActive(false); // cube2.SetActive(true); //} //This PointerCameraListener listener = hotspot.GetComponent <PointerCameraListener>(); if (listener == null) { hotspot.AddComponent <PointerCameraListener>(); } }
public void OnRelease() { HotspotController.EnableHotspotsForAllControllers(); if (transform.parent != null) { Destroy(transform.parent.gameObject); } }
private void Update() { if (isFirst) { DarkenBackground.CurrentDarkenBackground.TurnOn(0.7f); HotspotController.DisableHotspotForAllControllers(); isFirst = false; } }
public static void GenerateControllerJSON(HotspotController controller) { var serializedController = SerializeController(controller); string json = JsonUtility.ToJson(serializedController); print(controller.transform.childCount + " Hotspots"); print(json); }
private IEnumerator Start() { if (Instance == null) { Instance = this; } yield return(null); Fader.FadeToClear((b) => { SetPointer(true); }); }
// Start is called before the first frame update void Start() { HotspotController.DisableHotspotForAllControllers(); }
// Start is called before the first frame update void Start() { DarkenBackground.CurrentDarkenBackground.TurnOn(0.7f); HotspotController.DisableHotspotForAllControllers(); }
public void EnableHotspots() { HotspotController.EnableHotspotsForAllControllers(); }
public SerializedHotspotController(HotspotController hotspotController) { }
/// <summary> /// Loads all the 360 videos and their media objects from a url to an xml file. /// </summary> /// <param name="file_path">url of the xml file</param> public void LoadXmlFile(string file_path) { XmlDocument document = new XmlDocument(); document.Load(file_path); if (document.LastChild.Name.Equals("presentation360")) { XmlNode head = document.LastChild.FirstChild; XmlNode body = document.LastChild.LastChild; Dictionary <string, XmlNode> styles = new Dictionary <string, XmlNode>(); //reading head nodes foreach (XmlNode head_child in head.ChildNodes) { if (head_child.Name.Equals("style")) { string id_style = head_child.Attributes.GetNamedItem("id").Value; head_child.Attributes.RemoveNamedItem("id"); styles.Add(id_style, head_child); } } //reading video360 body nodes Dictionary <string, GameObject> scene_objects = new Dictionary <string, GameObject>(); foreach (XmlNode body_child in body.ChildNodes) { if (body_child.Name.Equals("scene360")) { string id = body_child.Attributes.GetNamedItem("id").Value; string src = body_child.Attributes.GetNamedItem("src").Value; float volume = 1f; XmlNode volume_node = body_child.Attributes.GetNamedItem("volume"); if (volume_node != null) { volume = float.Parse(volume_node.Value); } GameObject new_scene360 = AddVideo360(src: src, volume: volume); scene_objects.Add(id, new_scene360); AddAdditionalMedia(body_child, new_scene360, scene_objects, styles); } } foreach (string media_id in scene_objects.Keys) { GameObject curMedia; curMedia = scene_objects[media_id]; HotspotController hotspotController = curMedia.GetComponent <HotspotController>(); if (hotspotController != null) { if (scene_objects.Keys.Contains(hotspotController.on_focus_name)) { hotspotController.on_focus_object = scene_objects[hotspotController.on_focus_name]; } if (scene_objects.Keys.Contains(hotspotController.during_out_of_focus_name)) { hotspotController.during_out_of_focus_object = scene_objects[hotspotController.during_out_of_focus_name]; } } MirrorController mirrorController = curMedia.GetComponent <MirrorController>(); if (mirrorController != null) { if (scene_objects.Keys.Contains(mirrorController.file_path)) { mirrorController.src_hotspot_object = scene_objects[mirrorController.file_path]; } } MediaControllerAbstract mediaControllerAbstract = curMedia.GetComponent <MediaControllerAbstract>(); if (mediaControllerAbstract != null) { if (scene_objects.Keys.Contains(mediaControllerAbstract.on_select_name)) { mediaControllerAbstract.on_select_object = scene_objects[mediaControllerAbstract.on_select_name]; } mediaControllerAbstract.Load(); } } SetAsInitial(scene_objects[body.Attributes.GetNamedItem("entry").Value]); } }