/// <summary>画面を更新する</summary>
        public void LateUpdate()
        {
            // キー入力で切替える:オン/オフ
            if (Input.GetKeyDown(m_cfg.KeyTogglePower.ToLower()))
            {
                if (m_bActive)
                {
                    m_bActive = false; // 終了
                }
                else
                {
                    m_bActive     = true; // 開始
                    m_fTimeOrigin = Time.time;
                }
            }
            if (!m_bActive)
            {
                return; // 非アクティブ時は何もしない
            }
            CameraMain mainCamera = GameMain.Instance.MainCamera;
            Transform  cameraT    = mainCamera.camera.transform;

            // 移動量を計算
            float dT    = Time.time - m_fTimeOrigin;
            float pitch = m_cfg.PitchAmp * Mathf.Sin(m_cfg.PitchFreq * dT);
            float roll  = m_cfg.RollAmp * Mathf.Sin(m_cfg.RollFreq * dT);

            // 注視点を中心にカメラ移動
            Vector3 target = mainCamera.GetTargetPos();

            cameraT.RotateAround(target, Vector3.up, pitch);
            cameraT.RotateAround(target, Vector3.right, roll);
            // 微妙にバンク?するので正立させる
            cameraT.LookAt(target, Vector3.up);
        }
Пример #2
0
 private void SaveCameraPos()
 {
     oldPos       = mainCamera.GetPos();
     oldTargetPos = mainCamera.GetTargetPos();
     oldDistance  = mainCamera.GetDistance();
     oldRotation  = mainCameraTransform.rotation;
     oldFoV       = Camera.main.fieldOfView;
 }
Пример #3
0
        private void SaveCameraPos()
        {
            Assert.IsNotNull(mainCamera);
            Assert.IsNotNull(mainCameraTransform);

            oldCameraPos = mainCamera.GetPos();
            oldTargetPos = mainCamera.GetTargetPos();
            oldDistance  = mainCamera.GetDistance();
            oldRotation  = mainCameraTransform.rotation;
            oldFoV       = Camera.main.fieldOfView;
        }
        void Update()
        {
            if (Application.loadedLevel != 5)
            {
                return;
            }
            if (editViewReset == null)
            {
                editViewReset = UnityEngine.Object.FindObjectOfType <EditViewReset>();
            }
            if (sceneEdit == null)
            {
                sceneEdit = UnityEngine.Object.FindObjectOfType <SceneEdit>();
            }
            if (editViewReset != null && sceneEdit != null)
            {
                Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);

                if (bLevelWasLoaded)
                {
                    bLevelWasLoaded = false;
                    LoadSettings(maid);
                }

                // UICamera.InputEnable が False になるとサムネール撮影用のために着衣状態になる
                TBody tbody = maid == null ? null : maid.body0;
                if (tbody != null && fieldInfo_TBody_m_eMaskMode != null && UICamera.InputEnable)
                {
                    lastMaid            = maid;
                    bLastAutoCam        = editViewReset.GetVisibleAutoCam();
                    bLastEyeToCam       = editViewReset.GetVisibleEyeToCam();
                    lastBgName          = GameMain.Instance.BgMgr.GetBGName();
                    lastClothMaskMode   = (TBody.MaskMode)fieldInfo_TBody_m_eMaskMode.GetValue(tbody);
                    lastPoseName        = tbody.LastAnimeFN;
                    lastCameraPos       = mainCamera.GetPos();
                    lastCameraTargetPos = mainCamera.GetTargetPos();
                    lastCameraDistance  = mainCamera.GetDistance();
                    lastCameraRotation  = Camera.main.gameObject.transform.rotation;
                    lastCameraFov       = Camera.main.fieldOfView;
                }
            }
        }
        void Update()
        {
            if (Application.loadedLevel != 5)
            {
                return;
            }
            if (editViewReset == null)
            {
                editViewReset = UnityEngine.Object.FindObjectOfType <EditViewReset>();
            }
            if (sceneEdit == null)
            {
                sceneEdit = UnityEngine.Object.FindObjectOfType <SceneEdit>();
            }

            {
                string     gridName = "/UI Root/PresetButtonPanel/ItemPresetsViewer/Scroll View/Grid";
                GameObject goGrid   = GameObject.Find(gridName);
                if (goGrid != null)
                {
                    if (poseButtonCallback == null)
                    {
                        poseButtonCallback = new EventDelegate.Callback(ClickPoseCallback);
                    }
                    foreach (Transform t in goGrid.transform)
                    {
                        if (!t.name.StartsWith("Pose_"))
                        {
                            continue;
                        }
                        GameObject go       = t.gameObject;
                        UIButton   uiButton = go.GetComponent <UIButton>();
                        EventDelegate.Add(uiButton.onClick, poseButtonCallback);
                    }
                }
            }

            if (editViewReset != null && sceneEdit != null)
            {
                Maid maid = GameMain.Instance.CharacterMgr.GetMaid(0);

                if (bLevelWasLoaded)
                {
                    bLevelWasLoaded = false;
                    LoadSettings(maid);
                }

                // UICamera.InputEnable が False になるとサムネール撮影用のために着衣状態になる
                TBody tbody = maid == null ? null : maid.body0;
                if (tbody != null && fieldInfo_TBody_m_eMaskMode != null && UICamera.InputEnable)
                {
                    lastMaid            = maid;
                    bLastAutoCam        = editViewReset.GetVisibleAutoCam();
                    bLastEyeToCam       = editViewReset.GetVisibleEyeToCam();
                    lastBgName          = GameMain.Instance.BgMgr.GetBGName();
                    lastClothMaskMode   = (TBody.MaskMode)fieldInfo_TBody_m_eMaskMode.GetValue(tbody);
                    lastCameraPos       = mainCamera.GetPos();
                    lastCameraTargetPos = mainCamera.GetTargetPos();
                    lastCameraDistance  = mainCamera.GetDistance();
                    lastCameraRotation  = Camera.main.gameObject.transform.rotation;
                    lastCameraFov       = Camera.main.fieldOfView;
                }
            }
        }