Exemple #1
0
    private void ResetInput()
    {
        isFirstTouch     = true;
        oldWorldTouchPos = Vector3.zero;
        dragDelta        = Vector3.zero;

        // カメラ操作のアンロック
        if (flyThroughCamera != null)
        {
            flyThroughCamera.UnlockInput(this.gameObject);
        }
        if (pinchZoomCamera != null)
        {
            pinchZoomCamera.UnlockInput(this.gameObject);
        }
        if (orbitCamera != null)
        {
            orbitCamera.UnlockInput(this.gameObject);
        }

        // コンポーネントをON
        foreach (MonoBehaviour component in disableComponents)
        {
            if (component != null)
            {
                component.enabled = true;
            }
        }
    }
    private void ResetInput()
    {
        // ピンチセンターへのズーム設定をリセット
        if (!isFirstTouch && zoomToPinchCenterFor2D)
        {
            if (flyThroughCamera != null)
            {
                Ray        ray = this.gameObject.GetComponent <Camera>().ScreenPointToRay(new Vector3(Screen.width / 2.0f, Screen.height / 2.0f, 0.0f));
                RaycastHit hitInfo;

                if (flyThroughCamera.groundCollider.Raycast(ray, out hitInfo, float.PositiveInfinity))
                {
                    // カメラ位置
                    flyThroughCamera.TranslateToFlyThrough(hitInfo.point - flyThroughCamera.currentPos);
                    flyThroughCamera.ShiftTransform.localPosition = Vector3.zero;

                    // カメラシフト
                    foreach (CameraShifter cameraShifter in cameraShifterListForZtoPC)
                    {
                        cameraShifter.shiftX = 0.0f;
                        cameraShifter.shiftY = 0.0f;
                    }
                }
            }
        }

        isFirstTouch       = true;
        oldDistance        = 0.0f;
        currentDistance    = 0.0f;
        calcZoom           = 0.0f;
        velocitySmoothZoom = 0.0f;
        dampZoomDelta      = 0.0f;
        pushZoomDelta      = 0.0f;
        pinchCenter        = Vector2.zero;

        // カメラ操作のアンロック
        if (flyThroughCamera != null)
        {
            flyThroughCamera.UnlockInput(this.gameObject);
        }
        if (orbitCamera != null)
        {
            orbitCamera.UnlockInput(this.gameObject);
        }

        // 連携コンポーネントをON
        foreach (MonoBehaviour component in disableComponents)
        {
            if (component != null)
            {
                component.enabled = true;
            }
        }
    }