public void OnInputClicked(InputClickedEventData eventData) { switch (m_state) { case State.Scanning: SetState(State.FinalizeScan); break; case State.Playing: m_magnetOn = !m_magnetOn; if (m_magnetOn) { MonoBehaviour[] objects = FindObjectsOfType <MonoBehaviour>(); foreach (MonoBehaviour obj in objects) { IMagnetic magnetic = obj as IMagnetic; if (magnetic != null) { float distance = (magnet.transform.position - obj.transform.position).magnitude; if (distance < 1) { AttachToMagnet(obj.gameObject); magnetic.OnMagnet(true); m_magnetObjects.Add(obj.gameObject); } } } } else { foreach (GameObject obj in m_magnetObjects) { DetachFromMagnet(obj); obj.GetComponent <IMagnetic>().OnMagnet(false); } m_magnetObjects.Clear(); } break; } }
public void OnInputClicked(InputClickedEventData eventData) { if (!EnableActivation) { return; } Selected = !Selected; if (Activated != null) { Activated(this); } if (gameObject.name == "button_play_pause") { GameObject button = this.gameObject.transform.GetChild(0).GetChild(0).gameObject; TextMesh button_text = button.GetComponent <TextMesh>(); var dummy = PlayerPrefs.GetInt("play_pause_flag") == 1 ? (button_text.text = "Play") : (button_text.text = "Pause"); PlayerPrefs.SetInt("play_pause_flag", PlayerPrefs.GetInt("play_pause_flag") == 1 ? 0 : 1); } if (gameObject.name == "button_back") { Scene m_Scene = SceneManager.GetActiveScene(); Debug.Log("the scene here in menu is " + m_Scene.name); if (m_Scene.name != "Scene1") { StartCoroutine(loadScene("testing/Scenes/Scene1")); } } if (gameObject.name == "button_share") { //m_networkManager = gameObject.GetComponent<NetworkManager>(); //m_networkManager.StartHost(); } eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers. }
public void OnInputClicked(InputClickedEventData eventData) { GameObject focusedObject = FocusManager.Instance.GetFocusedObject(GazeManager.Instance); if (focusedObject == null) { // Debug.Log("Focused Object null"); if (HoverScript.activeObj != null) { //Debug.Log("Active Object not null"); HoverScript.informationPanel.SetActive(false); HoverScript.buttonSettings.SetActive(true); HoverScript.buttonExtended.SetActive(false); HoverScript.buttonDeveloper.SetActive(false); HoverScript.boundingBox.SetActive(false); GameObject.Find("Holograms").GetComponent <PanelScript>().keyboard.Close(); HoverScript activeHover = HoverScript.activeObj.GetComponent <HoverScript>(); } } }
public void OnInputClicked(InputClickedEventData eventData) { if (selected != true) { selected = true; GetComponent <TextMesh>().text = "Stop"; GameObject bbox = GameObject.FindGameObjectWithTag("BoundingBox"); Renderer[] rend = bbox.GetComponentsInChildren <Renderer>(); Collider[] coll = bbox.GetComponentsInChildren <Collider>(); for (int i = 1; i < 15; i++) { Debug.Log(rend[i].name); rend[i].enabled = false; coll[i].enabled = false; } AudioClip clickOff = Resources.Load <AudioClip>("ClickOn"); bbox.GetComponent <AudioSource>().clip = clickOff; bbox.GetComponent <AudioSource>().Play(); } else { selected = false; GetComponent <TextMesh>().text = "Auto X\nRotate"; GameObject bbox = GameObject.FindGameObjectWithTag("BoundingBox"); Renderer[] rend = bbox.GetComponentsInChildren <Renderer>(); Collider[] coll = bbox.GetComponentsInChildren <Collider>(); for (int i = 1; i < 15; i++) { rend[i].enabled = true; coll[i].enabled = true; } AudioClip clickOff = Resources.Load <AudioClip>("ClickOff"); bbox.GetComponent <AudioSource>().clip = clickOff; bbox.GetComponent <AudioSource>().Play(); } this.GetComponent <Renderer>().material.color = startColor; }
public void OnInputClicked(InputClickedEventData eventData) { PhotoCapture.CreateAsync(false, delegate(PhotoCapture captureObject) { photoCaptureObj = captureObject; CameraParameters cameraParameters = new CameraParameters(); cameraParameters.hologramOpacity = 0.0f; cameraParameters.cameraResolutionWidth = cameraResolution.width; cameraParameters.cameraResolutionHeight = cameraResolution.height; cameraParameters.pixelFormat = CapturePixelFormat.BGRA32; photoCaptureObj.StartPhotoModeAsync(cameraParameters, delegate(PhotoCapture.PhotoCaptureResult result) { photoCaptureObj.TakePhotoAsync(OnCapturedPhotoToMemory); }); }); Debug.Log("Photo Capture CreateAsync Succeed!"); }
public void OnInputClicked(InputClickedEventData eventData) { foreach (var user in userList.Users) { if (user.Value.Equals(textAsset.text)) { NetworkMessages.Instance.SendPresenterId(user.Key); var headInfo = HeadManager.Instance.GetRemoteHeadInfo(user.Key); if (headInfo != null) { for (var i = 0; i < HeadManager.Instance.Panels.Length; i++) { var billboard = HeadManager.Instance.Panels[i].GetComponent <Billboard>(); billboard.TargetTransform = headInfo == null ? Camera.main.transform : headInfo.HeadObject.transform; } } } } }
public void OnInputClicked(InputClickedEventData eventData) { if (eventData.used) { return; } eventData.Use(); if (showUserHistory) { string username = transform.parent.parent.GetComponent <Tweet>().GetUsername(); collider.enabled = false; StartCoroutine(GetUserNodes(username)); } else { DestroyUserHistory(); buttonText.Text = "Show History"; } showUserHistory = !showUserHistory; }
public void OnInputClicked(InputClickedEventData eventData) { eventData.Use(); // イベントが使われたことを記録して、他の処理に受け取られるのを防ぐ GameObject GlobalParams = GameObject.FindGameObjectWithTag("Global Params"); if (GlobalParams != null) { SyncSpawnedGlobalParams syncSpawnedGlobalParams = (SyncSpawnedGlobalParams)GlobalParams. GetComponent <DefaultSyncModelAccessor>().SyncModel; bool shouldHoldBarMagnet = syncSpawnedGlobalParams.ShouldHoldBarMagnetZPosition.Value; if (!shouldHoldBarMagnet) { syncSpawnedGlobalParams.ShouldHoldBarMagnetZPosition.Value = true; } else { syncSpawnedGlobalParams.ShouldHoldBarMagnetZPosition.Value = false; } } }
public void OnInputClicked(InputClickedEventData eventData) { /*string quadrantName = transform.parent.parent.parent.name + transform.parent.name ; * menuController.HandleQuadrantSelection(quadrantName); */ if (isCenterSliceON && menuController.currentButton != null) { animator.SetBool("b_isClicked", true); radarController.setquadrantName(transform.parent.parent.parent.parent.name); //Debug.Log(quadrantName); contentToPrint = radarController.getquadrantName() + this.gameObject.name; menuController.PrintContent(contentToPrint); //Used to store which button was selected radarController.SliceSelect(contentToPrint); } //Removes the "Clicked State" when you click another Slice if (radarController.getCurrentSlice() != contentToPrint) { animator.SetBool("b_isClicked", false); } }
public void OnInputClicked(InputClickedEventData eventData) { PrimaryText = "Scanning in finishing, wait for finalization"; if ((SpatialUnderstanding.Instance.ScanState == SpatialUnderstanding.ScanStates.Scanning) && !SpatialUnderstanding.Instance.ScanStatsReportStillWorking) { SpatialUnderstanding.Instance.RequestFinishScan(); PrimaryText = "Scanning Is Finished"; gameObject.SetActive(false); SpatialUnderstanding.Instance.UnderstandingCustomMesh.DrawProcessedMesh = false; //if (!ObjectSummoned) //{ // COMObject.OnScanFinished(); // ObjectSummoned = true; // gameObject.SetActive(false); //} } }
public void OnInputClicked(InputClickedEventData eventData) { if (_createdToolTip == null) { _createdToolTip = Instantiate(ToolTip); var toolTip = _createdToolTip.GetComponent <ToolTip>(); toolTip.ShowOutline = false; toolTip.ShowBackground = true; toolTip.ToolTipText = gameObject.name; toolTip.transform.position = transform.position + Vector3.up * 0.2f; toolTip.transform.parent = transform.parent; toolTip.AttachPointPosition = transform.position; toolTip.ContentParentTransform.localScale = new Vector3(0.05f, 0.05f, 0.05f); var connector = toolTip.GetComponent <ToolTipConnector>(); connector.Target = _createdToolTip; } else { Destroy(_createdToolTip); _createdToolTip = null; } }
public void OnInputClicked(InputClickedEventData eventData) { // Increase the scale of the object just as a response. robot = GameObject.Find("baxter"); gameObject.transform.localScale += 0.05f * gameObject.transform.localScale; string path = Path.Combine(Application.persistentDataPath, "MyFile2.txt"); theSourceFile = new FileInfo(path); reader = theSourceFile.OpenText(); while (text != null) { text = reader.ReadLine(); //Console.WriteLine(text); string[] splitString = text.Split(new string[] { " " }, StringSplitOptions.None); float xpos = float.Parse(splitString[2]); float ypos = float.Parse(splitString[3]); float zpos = float.Parse(splitString[4]); string itemname = splitString[5]; float relx = xpos + robot.transform.position.x; float rely = ypos + robot.transform.position.y; float relz = zpos + robot.transform.position.z; GameObject s = Instantiate(NewSphere, this.transform.position, this.transform.rotation); //GameObject s = (GameObject)Instantiate(Resources.Load("Prefabs/RedSphere")); ; //s.transform.position = new Vector3(robot.transform.position.x, robot.transform.position.y, robot.transform.position.z); s.transform.position = new Vector3(relx, rely, relz); //s.transform.position = new Vector3(-2.1f+ robot.transform.position.x, 0.72f+ robot.transform.position.y, robot.transform.position.z+0.71f); s.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); //s.name = "spoon"; s.name = itemname; //this.GetComponent<SphereNameManager>().addToDictionary(s); //adds the sphere to the dictionary //s.transform.GetChild(0).GetComponent<GetRelativePosition>().setItemName("bubbawubba!"); } eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers. }
/// <inheritdoc /> public void OnInputClicked(InputClickedEventData eventData) { if (!_cursor) { return; } Vector2 position; RectTransformUtility.ScreenPointToLocalPointInRectangle(_rectTransform, _mainCamera.WorldToScreenPoint(_cursor.Position), _mainCamera, out position); #if UNITY_EDITOR if (_clicked) { _clicked = false; return; } _clicked = true; #endif OnPixelSelected(position); }
public virtual void OnInputClicked(InputClickedEventData eventData) { // On each tap gesture, toggle whether the user is in placing mode. IsBeingPlaced = !IsBeingPlaced; // If the user is in placing mode, display the spatial mapping mesh. if (IsBeingPlaced) { spatialMappingManager.DrawVisualMeshes = true; Debug.Log(anchorTarget.name + " : Removing existing world anchor if any."); anchorManager.RemoveAnchor(anchorTarget); } // If the user is not in placing mode, hide the spatial mapping mesh. else { spatialMappingManager.DrawVisualMeshes = false; // Add world anchor when object placement is done. anchorManager.AttachAnchor(anchorTarget, SavedAnchorFriendlyName); } }
public void OnInputClicked(InputClickedEventData eventData) { // Increase the scale of the object just as a response. { if (food) { playervitals.Hungerslider.value += value; gameObject.SetActive(false); } else if (water) { playervitals.Thirstslider.value += value; gameObject.SetActive(false); } else if (health) { playervitals.Healthslider.value += value; gameObject.SetActive(false); } } }
public void OnInputClicked(InputClickedEventData eventData) { RaycastHit hitInfo; if (Physics.Raycast( Camera.main.transform.position, Camera.main.transform.forward, out hitInfo, 100.0f, Physics.DefaultRaycastLayers)) { if (hitInfo.collider.tag.Equals("centerWall")) { GameObject go = Instantiate(foodSpawnerPrefab, Camera.main.transform.position, Quaternion.identity); Rigidbody rb = go.GetComponent <Rigidbody>(); rb.velocity = Camera.main.transform.forward * 10f; return; } char num = hitInfo.collider.tag[hitInfo.collider.tag.Length - 1]; string hitTag = hitInfo.collider.tag.Substring(0, hitInfo.collider.tag.Length - 1); if (hitTag.Equals("button")) { if (buy.itemInfo[num - '0' - 1].price <= buy.balance) { del[num - '0' - 1](); Instantiate(fishPrefabs[num - '0' - 1], fishSpawner.transform.position, fishSpawner.gameObject.transform.rotation); ui.setFish(++ui.fishCount); } return; } } GameObject go2 = Instantiate(arrowPrefab, arrowSpawn.position, Quaternion.identity); Rigidbody rb2 = go2.GetComponent <Rigidbody>(); rb2.velocity = Camera.main.transform.forward * shootForce; }
public void OnInputClicked(InputClickedEventData eventData) { eventData.Use(); GameObject GlobalParams = GameObject.FindGameObjectWithTag("Global Params"); if (GlobalParams != null) { SyncSpawnedGlobalParams syncSpawnedGlobalParams = (SyncSpawnedGlobalParams)GlobalParams. GetComponent <DefaultSyncModelAccessor>().SyncModel; bool shouldShowMagneticForceLines = syncSpawnedGlobalParams.ShouldShowMagneticForceLines.Value; if (!shouldShowMagneticForceLines) { syncSpawnedGlobalParams.ShouldShowMagneticForceLines.Value = true; } else { syncSpawnedGlobalParams.ShouldShowMagneticForceLines.Value = false; } } }
public void OnInputClicked(InputClickedEventData eventData) { Vector3 curLoc = transform.position; // last index is closest element string[] closestWords = new string[6]; float[] closestDistances = new float[6]; for (int i = 0; i < 6; i++) { closestWords[i] = "xd"; closestDistances[i] = 999; } Balls[] ball_list = FindObjectsOfType <Balls>(); for (int i = 0; i < ball_list.Length; i++) { Balls b = ball_list[i]; UpdateClosest(curLoc, b.transform.position, b.name, closestWords, closestDistances); } if (activated) { rend.material.color = Color.green; } else { rend.material.color = Color.gray; } activated = !activated; GameObject selectedWord = GameObject.Find("SelectedWord"); selectedWord.GetComponent <Text>().text = "Selected Word: " + System.Convert.ToString(transform.name); GameObject nearestNeighbors = GameObject.Find("NearestNeighbors"); nearestNeighbors.GetComponent <Text>().text = GetNearestString(closestWords, closestDistances); }
//AirTapを検出したとき public void OnInputClicked(InputClickedEventData eventData) { //2.0でなく2.2で割るのはBullet Circleより画像が大きいため円の外に弾が生成されるのを防ぐための調整から float radius = BulletCircle.GetComponent <Renderer>().bounds.size.x *Random.Range(0, 1.0f) / 2.2f; float angle = Random.Range(0, 360); Vector3 vector = BulletCircle.transform.position; //射撃音再生 AudioSource.PlayOneShot(AudioClip); //弾丸の複製 GameObject Bullets = Instantiate(Bullet) as GameObject; //弾丸の位置を調整 Bullets.transform.position = MixedRealityCamera.position; //弾道のベクトル MRカメラと発射点の延長線上 Vector3 Ballistic = (GetPosition(angle, radius, vector) - MixedRealityCamera.position).normalized;; Vector3 force; //球の向きと速度設定 force = Ballistic * Speed; //Rigidbodyに力を加えて発射 Bullets.GetComponent <Rigidbody>().AddForce(force); //5秒後に弾丸消滅 GameObject.Destroy(Bullets, 5.0f); //shotCount(残弾数)の数値を1ずつ減らす。 ShotCount++; BulletLabel.text = "銃弾:" + ShotCount; }
public void OnInputClicked(InputClickedEventData eventData) { #if UNITY_UWP tcpConnection.sendDataAsync(); #endif if (eventData.TapCount == 1) { if (totalCount > (screenpointCount * worldpointCount) - 1) { Debug.Log("Done!!!"); } else { count++; totalCount++; if (count > 4) { count = 0; } Debug.Log("Current count: " + count); displayCross(count); } } else if (eventData.TapCount == 2) { count--; Debug.Log("TapCount == 2"); Debug.Log("Current count: " + count); } else { Debug.Log("Error clicking"); } }
public void OnInputClicked(InputClickedEventData eventData) { if (eventData.used) { return; } eventData.Use(); GameObject statsObj = GameObject.Instantiate(TweetManager.Instance.statsPanelPrefab , Wallet.Instance.transform); Vector3 localDestPos = new Vector3(0.0f, 0.0f, -0.50f); string username = transform.parent.parent.GetComponent <Tweet>().GetUsername(); StartCoroutine(statsObj.GetComponent <StatsPanel>().Initialise(username)); StartCoroutine(AnimateOpen(statsObj , Wallet.Instance.transform.InverseTransformPoint(transform.position) , new Vector3(0.0f, 0.0f, 0.0f) , localDestPos , TweetManager.Instance.statsPanelPrefab.transform.localScale)); }
public void OnInputClicked(InputClickedEventData eventData) { if (control == Control.PLAY) { board.playPressed(); } else if (control == Control.RECORD) { board.recordPressed(); } else if (control == Control.SOLO) { board.soloPressed(); } else if (control == Control.METRONOME) { board.metronomePressed(); } else if (control == Control.CLEAR) { board.clearPressed(); } }
public void OnInputClicked(InputClickedEventData eventData) { if (!eventData.used) { bool isGazingUI = IsGazingUI(); if (!isGazingUI) { if (ObjectStateManager.Instance.SelectedObject != GazeManager.Instance.HitObject) { ObjectStateManager.Instance.SelectedObject = GazeManager.Instance.HitObject; } else { ObjectStateManager.Instance.SelectedObject = null; } } else { return; } eventData.Use(); } }
protected override void InputClicked(GameObject obj, InputClickedEventData eventData) { switch (obj.name) { case "HolographicButton(3D)": { Debug.Log("start draw 3d implicit function"); implicitMenu.SetActive(false); inputPanel.SetActive(false); cw.calculate(inputField.text); break; } case "HolographicButton(2D)": { Debug.Log("start draw 2d implicit function"); implicitMenu.SetActive(false); inputPanel.SetActive(false); cw.calculatevec(inputField.text); break; } } }
// when clicked public void OnInputClicked(InputClickedEventData eventData) { // play audio this.gameObject.AddComponent <AudioSource>(); this.GetComponent <AudioSource>().clip = breadboardConnect; this.GetComponent <AudioSource>().Play(); // change text if (this.enabled != false) { changeText.text = "On either side of the breadboard are voltage rails. The positive is denoted by red and " + "the negative is denoted by blue. While a single column is electrically connected together, each rail is " + "independent of each other. Each row of the breadboard is also electrically connected " + "and separated by the bridge in the center."; } //throw new System.NotImplementedException(); TaskCompleted = true; this.enabled = false; // move to next in order IntroductionManager.Instance.CompletedIntroduction(); }
public void OnInputClicked(InputClickedEventData eventData) { RaycastHit hit = GazeManager.Instance.HitInfo; GameObject hitObj = GazeManager.Instance.HitObject; if (hitObj.tag == "bloxs") { Debug.Log("hit:" + hit.collider.transform.position); Vector3 exchange = hit.normal; exchange = new Vector3(exchange.x * 0.1f, exchange.y * 0.1f, exchange.z * 0.1f); // ブロックの設置 Transform blocksParentTf = blocksParent.transform; GameObject atObj = Instantiate(attachPrefab, hit.collider.transform.position + exchange, Quaternion.identity, blocksParentTf); atObj.tag = "bloxs"; //throw new System.NotImplementedException(); } }
/// <summary> /// Button 点击事件 /// </summary> /// <param name="eventData"></param> public void OnInputClicked(InputClickedEventData eventData) { buttonImage.sprite = selectedSprite; switch (type) { case ButtonType.Cancel: ModelManager.Instance.ResetCropBoxTransform(); ToolManager.Instance.HideMenu(); ModelManager.Instance.SetPhotoImageActive(false); ModelManager.Instance.SetCropBoxActive(false); ModelManager.Instance.SetTipText("air tap to take a photo"); CapturePhotoManager.Instance.SetCurrentStatus(CurrentStatus.Ready); break; case ButtonType.Done: CapturePhotoManager.Instance.ShowEditedImage(); ToolManager.Instance.HideMenu(); break; default: break; } }
/** * On click change the look at state */ public void OnInputClicked(InputClickedEventData eventData) { if (lookingAt) { lookingAt = false; flowAwayAnimationFrame = 0; if (putAudio != null) { putAudio.Play(); } Debug.Log("Put look at object away"); } else { QuestManager.GetInstance().currentlyWorkingOn(QuestManager.Quest.Document); lookingAt = true; if (takeAudio != null) { takeAudio.Play(); } Debug.Log("Look at object"); } }
private void GestureRecognizerTapped(TappedEventArgs args) { uint id = args.source.id; StatusText.text = $"Tapped - Kind:{args.source.kind.ToString()} - Id:{id}"; if (trackingObject.ContainsKey(activeId)) { ChangeObjectColor(trackingObject[activeId], TapColor); StatusText.text += "-TRACKED"; // code to send ray // code to tap if IInputClickHandler is present RaycastHit hit; if (Physics.Raycast(trackingObject[activeId].transform.position, trackingObject[activeId].transform.TransformDirection(-Vector3.forward), out hit, Mathf.Infinity)) { if (hit.collider.gameObject.GetComponent <IInputClickHandler>() != null) { InputClickedEventData data = new InputClickedEventData(GameObject.Find("EventSystem").GetComponent <EventSystem>()); hit.collider.gameObject.GetComponent <IInputClickHandler>().OnInputClicked(data); } } } }
public virtual void OnInputClicked(InputClickedEventData eventData) { foreach (GameObject arteria in arterias) { if (areActive) { arteria.SetActive(false); } else { arteria.SetActive(true); } } if (areActive) { areActive = false; } else { areActive = true; } }