diff --git a/Assets/Art/UITextures/UIInstruction/操作说明.png b/Assets/Art/UITextures/UIInstruction/操作说明.png index 2bce25f6..2056c6aa 100644 Binary files a/Assets/Art/UITextures/UIInstruction/操作说明.png and b/Assets/Art/UITextures/UIInstruction/操作说明.png differ diff --git a/Assets/Scenes/ExamScenes/01_YinHuanShiBie.unity b/Assets/Scenes/ExamScenes/01_YinHuanShiBie.unity index 3e13a13f..e5860d9d 100644 --- a/Assets/Scenes/ExamScenes/01_YinHuanShiBie.unity +++ b/Assets/Scenes/ExamScenes/01_YinHuanShiBie.unity @@ -3088,7 +3088,7 @@ AudioSource: OutputAudioMixerGroup: {fileID: 0} m_audioClip: {fileID: 8300000, guid: c967447a8f88ed14481d7ada52d149c4, type: 3} m_PlayOnAwake: 1 - m_Volume: 1 + m_Volume: 0.5 m_Pitch: 1 Loop: 1 Mute: 0 diff --git a/Assets/Scenes/ExamScenes/02_JianXiuJueCe.unity b/Assets/Scenes/ExamScenes/02_JianXiuJueCe.unity index 72f95d97..e0badde3 100644 --- a/Assets/Scenes/ExamScenes/02_JianXiuJueCe.unity +++ b/Assets/Scenes/ExamScenes/02_JianXiuJueCe.unity @@ -28405,7 +28405,7 @@ AudioSource: OutputAudioMixerGroup: {fileID: 0} m_audioClip: {fileID: 8300000, guid: c967447a8f88ed14481d7ada52d149c4, type: 3} m_PlayOnAwake: 1 - m_Volume: 0.8 + m_Volume: 0.5 m_Pitch: 1 Loop: 1 Mute: 0 diff --git a/Assets/Scripts/FreeCameraController.cs b/Assets/Scripts/FreeCameraController.cs index a31e2d0d..dc118b9e 100644 --- a/Assets/Scripts/FreeCameraController.cs +++ b/Assets/Scripts/FreeCameraController.cs @@ -4,17 +4,13 @@ public class FreeCameraController : MonoBehaviour { public static FreeCameraController instance; // ƶٶ - public float moveSpeed = 5.0f; // ƶٶ + public float moveSpeed = 5.0f; // תٶ - public float rotateSpeed = 0.05f; // תٶ + public float rotateSpeed = 0.05f; // XתΧ public float xRotationLimit = 80.0f; - // YתΧ - //public float yRotationLimit = 180.0f; - //public float minRotationLimitY = -1; - //public float maxRotationLimitY = -1; // Ƿײ - public bool enableCollision = false; // ĬϹرײ⣬Ҫ + public bool enableCollision = false; private Vector3 lastMousePosition; private bool isDragging = false; @@ -23,36 +19,14 @@ public class FreeCameraController : MonoBehaviour public bool isMov = true; public bool isRot = true; CharacterController ctrlor; + private void Awake() { instance = this; DontDestroyOnLoad(this); - - // Cm = GameObject.Find("Mcam"); ctrlor = GetComponent(); - - - Global.appSetting.MouseMoveSpeed.RegisterWithInitValue(v => rotateSpeed = v); } - /// - /// QEƶ - /// - /// - Vector3 GetInputTranslationDirection() - { - Vector3 direction = new Vector3(); - - if (Input.GetKey(KeyCode.Q)) - { - direction += Vector3.up; - } - if (Input.GetKey(KeyCode.E)) - { - direction += Vector3.down; - } - return direction; - } void Update() { @@ -68,48 +42,45 @@ public class FreeCameraController : MonoBehaviour transform.position += move; #else - //Wǰ + // ȡˮƽڵǰƶ + Vector3 moveDirection = Vector3.zero; + + //Wǰˮƽڣ if (Input.GetKey(KeyCode.W)) { - Vector3 forward = transform.TransformDirection(Vector3.forward); - ctrlor.Move(forward * moveSpeed * Time.deltaTime); - + Vector3 forward = Vector3.ProjectOnPlane(transform.forward, Vector3.up).normalized; + moveDirection += forward; } - //S + + //Sˣˮƽڣ if (Input.GetKey(KeyCode.S)) { - Vector3 back = transform.TransformDirection(Vector3.back); - ctrlor.Move(back * moveSpeed * Time.deltaTime); - + Vector3 back = -Vector3.ProjectOnPlane(transform.forward, Vector3.up).normalized; + moveDirection += back; } - //Aƶ + + //Aƣˮƽڣ if (Input.GetKey(KeyCode.A)) { - Vector3 left = transform.TransformDirection(Vector3.left); - ctrlor.Move(left * moveSpeed * Time.deltaTime); + Vector3 left = -Vector3.ProjectOnPlane(transform.right, Vector3.up).normalized; + moveDirection += left; } - //D - if (Input.GetKey(KeyCode.D) && gameObject.transform.position.y > 0) + + //Dƣˮƽڣ + if (Input.GetKey(KeyCode.D)) { - Vector3 right = transform.TransformDirection(Vector3.right); - ctrlor.Move(right * moveSpeed * Time.deltaTime); + Vector3 right = Vector3.ProjectOnPlane(transform.right, Vector3.up).normalized; + moveDirection += right; } - //E - if (Input.GetKey(KeyCode.Q)) + + // Ӧƶ + if (moveDirection != Vector3.zero) { - Vector3 upward = transform.TransformDirection(Vector3.up); - ctrlor.Move(upward * moveSpeed * Time.deltaTime); + ctrlor.Move(moveDirection * moveSpeed * Time.deltaTime); } - //E - if (Input.GetKey(KeyCode.E)) - { - Vector3 down = transform.TransformDirection(Vector3.down); - ctrlor.Move(down * moveSpeed * Time.deltaTime); - } - ////QEƶ - //transform.position+= GetInputTranslationDirection()*0.01f; #endif } + if (isRot) { if (Input.GetMouseButtonDown(1)) @@ -119,32 +90,23 @@ public class FreeCameraController : MonoBehaviour SyncRotation(); } - - - if (Input.GetMouseButtonUp(1)) { isDragging = false; } + if (isDragging) { // ת - - Vector3 mouseDelta = Input.mousePosition - lastMousePosition; // תֵ + Vector3 mouseDelta = Input.mousePosition - lastMousePosition; lastMousePosition = Input.mousePosition; - xRotation -= mouseDelta.y * rotateSpeed; // תXת + xRotation -= mouseDelta.y * rotateSpeed; yRotation += mouseDelta.x * rotateSpeed; // X תΧ xRotation = Mathf.Clamp(xRotation, -xRotationLimit, xRotationLimit); - // Y תΧ - //if (minRotationLimitY != -1 && maxRotationLimitY != -1) - //{ - // yRotation = Mathf.Clamp(yRotation, minRotationLimitY, maxRotationLimitY); - //} - transform.rotation = Quaternion.Euler(xRotation, yRotation, 0); } } @@ -158,9 +120,9 @@ public class FreeCameraController : MonoBehaviour SyncRotation(); } - public void Rotate(Vector3 eulerAngels) + public void Rotate(Vector3 eulerAngles) { - transform.eulerAngles = eulerAngels; + transform.eulerAngles = eulerAngles; SyncRotation(); } diff --git a/Data/Xml/01_YinHuanShiBie.xml b/Data/Xml/01_YinHuanShiBie.xml index a90902ba..e0769770 100644 --- a/Data/Xml/01_YinHuanShiBie.xml +++ b/Data/Xml/01_YinHuanShiBie.xml @@ -213,9 +213,9 @@ - - - + + + diff --git a/Data/Xml/02_JianXiuJueCe.xml b/Data/Xml/02_JianXiuJueCe.xml index 8c07c78b..0a9a7218 100644 --- a/Data/Xml/02_JianXiuJueCe.xml +++ b/Data/Xml/02_JianXiuJueCe.xml @@ -288,8 +288,8 @@ - - + +