//__ void PCInput() { if (Input.GetMouseButtonDown(0)) { if (_KUBRotation.instance.isTurning == false) { rayPC = _InGameCamera.instance.NormalCam.ScreenPointToRay(Input.mousePosition); inputPosition = Input.mousePosition; if (Physics.Raycast(rayPC, out aimingHit)) { if (aimingHit.collider.gameObject.GetComponent <_CubeMove>() == true) { cubeMove = aimingHit.collider.gameObject.GetComponent <_CubeMove>(); if (cubeMove.isSelectable == true) { cubeMove.isSeletedNow = true; cubeMove.GetBasePoint(); cubeMove.AddOutline(true); audioSource.Play(); } else { cubeMove.SetupCantMoveSound(); cubeMove.AddOutline(false); } } } else { _InGameCamera.instance.isCameraMove = true; } } } else if (Input.GetMouseButton(0)) { inputPosition = Input.mousePosition; if (cubeMove != null && cubeMove.isSelectable == true) { cubeMove.NextDirection(); } } else if (Input.GetMouseButtonUp(0)) { _InGameCamera.instance.isCameraMove = false; _InGameCamera.instance.SetupCameraPcInputBool = false; if (cubeMove != null) { EndSwipe.Invoke(); cubeMove.isSeletedNow = false; cubeMove = null; } } }
void PhoneInput() { if (Input.touchCount == 1) { touch = Input.GetTouch(0); inputPosition = touch.position; rayTouch = _InGameCamera.instance.NormalCam.ScreenPointToRay(touch.position); // Handle finger movements based on TouchPhase switch (touch.phase) { //When a touch has first been detected, change the message and record the starting position case TouchPhase.Began: if (_KUBRotation.instance.isTurning == false) { if (Physics.Raycast(rayTouch, out aimingHit)) { if (aimingHit.collider.gameObject.GetComponent <_CubeMove>() == true) { cubeMove = aimingHit.collider.gameObject.GetComponent <_CubeMove>(); if (cubeMove.isSelectable == true) { cubeMove.isSeletedNow = true; cubeMove.GetBasePoint(); cubeMove.AddOutline(true); audioSource.Play(); } else { cubeMove.SetupCantMoveSound(); cubeMove.AddOutline(false); } } } else { _InGameCamera.instance.isCameraMove = true; } } break; case TouchPhase.Moved: //EMouv.Invoke(); inputPosition = touch.position; if (cubeMove != null && cubeMove.isSelectable == true) { cubeMove.NextDirection(); } break; case TouchPhase.Ended: { _InGameCamera.instance.isCameraMove = false; if (cubeMove != null) { cubeMove.StopPlayingSound(); EndSwipe.Invoke(); cubeMove.isSeletedNow = false; cubeMove = null; } } break; } } }