/// <summary> /// Plots the marker. /// </summary> /// <param name="marker">Marker.</param> void plotMarker(MarkerObject marker) { GameObject gameObject = statDefaultMarker; // Get the custom gameobject to be instantiated for marker based on the type if it exists. if (markerTagging.ContainsKey(marker.type)) { gameObject = markerTagging [marker.type]; } // Instantiate the game object at the specified unity location and add the trigger scripts for gaze and click actions. Vector3 gameObjectPosition = new Vector3((float)marker.x, (float)maxBuildingHeight + 1, (float)marker.z); GameObject placedMarker = Instantiate(gameObject, gameObjectPosition, Quaternion.identity); placedMarker.name = marker.title; MarkerEventTrigger trigger = placedMarker.AddComponent <MarkerEventTrigger> (); trigger.setMarkerObj(marker); }
/// <summary> /// Shows the marker details. /// </summary> /// <param name="selectedMarker">Selected marker.</param> public static void showMarkerDetails(MarkerObject selectedMarker) { GameObject obj = GameObject.Find("MarkerDetails"); GameObject timerCanvas = obj.transform.Find("InfoCanvas").gameObject; //Show the hidden canvas information //Draw the line and position the canvas at the right position and rotate the canvas to show billboard effect timerCanvas.SetActive(true); GameObject infoTitle = GameObject.Find("MarkerInfoTitle"); GameObject infoContents = GameObject.Find("MarkerInfoDetails"); Text titleText = infoTitle.GetComponent <Text> (); titleText.text = selectedMarker.title; Text detailText = infoContents.GetComponent <Text> (); detailText.text = selectedMarker.getContentDisplayText(); GameObject mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); Vector3 cameraPos = mainCamera.transform.position; Vector2 camVec = new Vector2(cameraPos.x, cameraPos.z); Vector2 markerVec = new Vector2(selectedMarker.x, selectedMarker.z); Vector2 transPos = getVectorFromEnd(camVec, markerVec, 300); obj.transform.position = new Vector3(transPos.x, 200, transPos.y); GameObject playerGameObj = GameObject.Find("Player"); moveCamera(playerGameObj, camVec, markerVec); }
public void setMarkerObj(MarkerObject markerObj) { this.markerObj = markerObj; }