private void TouchProcessSingle() { if (cpInput.GetTouchCount() != cpTouchCount) { cpTouchState = EnTouchActionState.None; return; } if (cpTouchState == EnTouchActionState.Fail) { return; } if (cpTouchState == EnTouchActionState.None) { if (IsTouchTarget(cpInput.GetTouchObject()) == true) { cpTouch1Position = cpInput.GetTouch(0).position; cpTouchState = EnTouchActionState.Down; } else { cpTouchState = EnTouchActionState.Fail; return; } } if (cpTouchState == EnTouchActionState.Down) { cpTouch2Position = cpInput.GetTouch(0).position; if (Vector2.Distance(cpTouch1Position, cpTouch2Position) > cpTouchBoundary) { cpTouch1Position = cpInput.GetTouch(0).position; if (Mathf.Abs(cpTouch1Position.x - cpTouch2Position.x) >= Mathf.Abs(cpTouch1Position.y - cpTouch2Position.y)) { cpTouchState = EnTouchActionState.DragX; } else { cpTouchState = EnTouchActionState.DragY; } } } if (cpTouchState == EnTouchActionState.DragX || cpTouchState == EnTouchActionState.DragY) { this.transform.Rotate(new Vector3((cpTouch2Position.y - cpTouch1Position.y) / cpResistivity, (cpTouch1Position.x - cpTouch2Position.x) / cpResistivity, 0), Space.World); cpTouch1Position = cpTouch2Position; cpTouch2Position = cpInput.GetTouch(0).position; HiEvent.EventDispatch(HiEventID.CubeRotation); } }
private void TouchProcessSingle() { if (cpInput.GetTouchCount() != cpTouchCount) { cpTouchState = EnTouchActionState.None; return; } if (cpTouchState == EnTouchActionState.None) { cpTouch1Position = cpInput.GetTouch(0).position; cpTouchState = EnTouchActionState.Down; } if (cpTouchState == EnTouchActionState.Down) { cpTouch2Position = cpInput.GetTouch(0).position; if (Vector2.Distance(cpTouch1Position, cpTouch2Position) > cpTouchBoundary) { cpCameraFieldOfView = Camera.main.fieldOfView; cpTouch1Position = cpTouch2Position = cpInput.GetTouch(0).position; cpTouchState = EnTouchActionState.Zoom; } } if (cpTouchState == EnTouchActionState.Zoom) { /* * cpTouch1Position = cpInput.GetTouch(0).position; * cpTouch2Position = Vector2.zero; * if (cpInput.GetTouchCount() == cpTouchCount) * { * if (Vector2.Distance(cpTouch1Position, cpTouch2Position) > cpInitTouchDist + 1) * { * ZoomIN(); * } * else if (Vector2.Distance(cpTouch1Position, cpTouch2Position) < cpInitTouchDist - 1) * { * ZoomOUT(); * } * cpInitTouchDist = Vector2.Distance(cpTouch1Position, cpTouch2Position); * } */ /* * cpTouch1Position = cpInput.GetTouch(0).position; * cpTouch2Position = Vector2.zero; * if (cpInput.GetTouchCount() == cpTouchCount) * { * if (Mathf.Abs(cpTouch1Position.y - cpTouch2Position.y) > cpInitTouchDist + 1) * { * ZoomIN(); * } * else if (Mathf.Abs(cpTouch1Position.y - cpTouch2Position.y) < cpInitTouchDist - 1) * { * ZoomOUT(); * } * cpInitTouchDist = Mathf.Abs(cpTouch1Position.y - cpTouch2Position.y); * } */ cpTouch2Position = cpInput.GetTouch(0).position; float _distance = (cpTouch1Position.y - cpTouch2Position.y) / cpResistivity; if (cpInput.GetTouchCount() == cpTouchCount) { //if (cpTouch1Position.y < cpTouch2Position.y) //{ // ZoomIN(cpCameraFieldOfView, _distance); //} //else if (cpTouch1Position.y > cpTouch2Position.y) //{ // ZoomOUT(cpCameraFieldOfView, _distance); //} SetCameraZoom(cpCameraFieldOfView, _distance); } } }