// Update is called once per frame void Update() { //¨ú±o°»´ú½d³ò rect = (Rect)(DisplayObject.GetType().GetField("_rect").GetValue(DisplayObject)); if (rect.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y))) { if (Input.GetKey(keyCode)) { if (EffectObjectWhenPress) { EffectObjectWhenPress.SetActive(true); } if (EffectObjectWhenRelease) { EffectObjectWhenRelease.SetActive(false); } pressDown = true; } if (pressDown) { if (Input.GetKeyUp(keyCode)) { if (Event) { GameObject newGameObject = (GameObject)Instantiate(Event); newGameObject.SetActive(true); } if (EffectObjectWhenPress) { EffectObjectWhenPress.SetActive(false); } if (EffectObjectWhenRelease) { EffectObjectWhenRelease.SetActive(true); } } } } else { if (pressDown) { if (EffectObjectWhenPress) { EffectObjectWhenPress.SetActive(false); } if (EffectObjectWhenRelease) { EffectObjectWhenRelease.SetActive(true); } pressDown = false; } } }
// Update is called once per frame void Update() { //¨ú±o°»´ú½d³ò rect = (Rect)(DisplayObject.GetType().GetField("_rect").GetValue(DisplayObject)); int i = 0; while (i < Input.touchCount) { if (rect.Contains(new Vector2(Input.GetTouch(i).position.x, Screen.height - Input.GetTouch(i).position.y))) { if (Input.GetTouch(i).phase == TouchPhase.Began) { if (EffectObjectWhenPress) { EffectObjectWhenPress.SetActive(true); } if (EffectObjectWhenRelease) { EffectObjectWhenRelease.SetActive(false); } pressDownPlatform[i] = true; } if (pressDownPlatform[i]) { if (Input.GetTouch(i).phase == TouchPhase.Ended) { if (Event) { GameObject newGameObject = (GameObject)Instantiate(Event); newGameObject.SetActive(true); } if (EffectObjectWhenPress) { EffectObjectWhenPress.SetActive(false); } if (EffectObjectWhenRelease) { EffectObjectWhenRelease.SetActive(true); } } } } else { if (Input.GetTouch(i).phase == TouchPhase.Ended) { if (EffectObjectWhenPress) { EffectObjectWhenPress.SetActive(false); } if (EffectObjectWhenRelease) { EffectObjectWhenRelease.SetActive(true); } pressDownPlatform[i] = false; } } i++; } }