//__ void PCInput() { if (Input.GetMouseButtonDown(0)) { rayPC = Camera_ZoomScroll.instance.cam.ScreenPointToRay(Input.mousePosition); Etouch.Invoke(); inputPosition = Input.mousePosition; if (Physics.Raycast(rayPC, out aimingHit, 300, CubeMouvable | CubeSticky)) { mouvCube = aimingHit.collider.gameObject.GetComponent <_MovableCube>(); mouvCube.GetBasePoint(); mouvCube.AddOutline(); } } else if (Input.GetMouseButton(0)) { inputPosition = Input.mousePosition; if (mouvCube != null) { mouvCube.NextDirection(); } } else if (Input.GetMouseButtonUp(0)) { Eswipe.Invoke(); mouvCube = null; } }
void PhoneInput() { if (Input.touchCount == 1) { touch = Input.GetTouch(0); inputPosition = touch.position; rayTouch = Camera_ZoomScroll.instance.cam.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: Etouch.Invoke(); if (Physics.Raycast(rayTouch, out aimingHit, 300, CubeMouvable | CubeSticky)) { mouvCube = aimingHit.collider.gameObject.GetComponent <_MovableCube>(); if (!mouvCube.isUnmoveable) { mouvCube.GetBasePoint(); mouvCube.AddOutline(); } } break; case TouchPhase.Moved: //EMouv.Invoke(); inputPosition = touch.position; if (mouvCube != null && !mouvCube.isUnmoveable) { mouvCube.NextDirection(); } break; case TouchPhase.Ended: Eswipe.Invoke(); mouvCube = null; break; } } }