private void CaseHackDeckUpdate() { if (state == "normal") { //Check if the left Mouse button is clicked if (Input.GetKeyDown(KeyCode.Mouse0) && hackBattleData.IsPlayerAllowedToDragCard()) { //Set up the new Pointer Event PointerEventData pointerData = new PointerEventData(EventSystem.current); List <RaycastResult> results = new List <RaycastResult>(); //Raycast using the Graphics Raycaster and mouse click position pointerData.position = Input.mousePosition; this.raycaster.Raycast(pointerData, results); if (AreWeClickingOnCard(results) && !hackDeck.IsDeckEmpty()) { checkClickController.SetDraggingDeckState(); state = "dragging"; } } } else if (state == "dragging") { if (Input.GetKeyUp(KeyCode.Mouse0)) { //Set up the new Pointer Event PointerEventData pointerData = new PointerEventData(EventSystem.current); List <RaycastResult> results = new List <RaycastResult>(); //Raycast using the Graphics Raycaster and mouse click position pointerData.position = Input.mousePosition; this.raycaster.Raycast(pointerData, results); checkClickController.SetDeckClickResult("attemptPlaceCard"); checkClickController.ListenForClickResults(); state = "goingback"; } } }
private void Update() { if (checkClickController.GetState() != "draggingDeck" && checkClickController.GetState() != "overlay") { if (Input.GetMouseButtonDown(0)) { checkClickController.ListenForClickResults(); checkClickController.SetCameraDragResult("attemptpan"); touchStart = Camera.main.ScreenToWorldPoint(Input.mousePosition); } if (cameraMoveOk) { if (Input.touchCount == 2) { Touch touchZero = Input.GetTouch(0); Touch touchOne = Input.GetTouch(1); Vector2 touchZeroPrevPos = touchZero.position - touchZero.deltaPosition; Vector2 touchOnePrevPos = touchOne.position - touchOne.deltaPosition; float prevMagnitude = (touchZeroPrevPos - touchOnePrevPos).magnitude; float currentMagnitude = (touchZero.position - touchOne.position).magnitude; float difference = currentMagnitude - prevMagnitude; Zoom(difference * 0.01f); } else if (Input.GetMouseButton(0)) { Vector3 direction = touchStart - Camera.main.ScreenToWorldPoint(Input.mousePosition); Camera.main.transform.position += direction; } Zoom(Input.GetAxis("Mouse ScrollWheel")); } } ClampCamera(); circuitBackground.UpdateBackgroundPos(); }