diff --git a/xiaofang/Assets/Scenes/Tmap 1.unity b/xiaofang/Assets/Scenes/Tmap 1.unity index 211e5cbb..ce715b83 100644 --- a/xiaofang/Assets/Scenes/Tmap 1.unity +++ b/xiaofang/Assets/Scenes/Tmap 1.unity @@ -13470,7 +13470,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1068997304} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -10.07, y: 3.58, z: -2.05} + m_LocalPosition: {x: -6.82, y: 1.67, z: 2} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -13490,8 +13490,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Character: {fileID: 382802812} - pivotOffset: {x: 0, y: 1.7, z: 0} - camOffset: {x: 0.2, y: 0.2, z: -1} + pivotOffset: {x: 0, y: 1.6, z: 0} + camOffset: {x: 0.2, y: 0, z: -1} smooth: 10 horizontalAimingSpeed: 6 verticalAimingSpeed: 6 @@ -14135,6 +14135,52 @@ Transform: m_CorrespondingSourceObject: {fileID: 454008, guid: c9aa675884b75594b9a1c43c5c4e5c7a, type: 3} m_PrefabInstance: {fileID: 1108412769} m_PrefabAsset: {fileID: 0} +--- !u!1 &1108700887 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1108700889} + - component: {fileID: 1108700888} + m_Layer: 0 + m_Name: BurstCollisionWorld + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1108700888 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1108700887} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f1a161c4294214a4fbcb7e9e94800494, type: 3} + m_Name: + m_EditorClassIdentifier: + cellSpans: + m_AlignBytes: 16 +--- !u!4 &1108700889 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1108700887} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 36 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1111438060 PrefabInstance: m_ObjectHideFlags: 0 @@ -29844,52 +29890,6 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 410985242629440748, guid: 9263a339010a182478c1a809e3f8ddf1, type: 3} m_PrefabInstance: {fileID: 2025302170} m_PrefabAsset: {fileID: 0} ---- !u!1 &2026547709 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2026547711} - - component: {fileID: 2026547710} - m_Layer: 0 - m_Name: BurstCollisionWorld - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &2026547710 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2026547709} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f1a161c4294214a4fbcb7e9e94800494, type: 3} - m_Name: - m_EditorClassIdentifier: - cellSpans: - m_AlignBytes: 16 ---- !u!4 &2026547711 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2026547709} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 36 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &2029521438 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/xiaofang/Assets/Scenes/sucai01.unity b/xiaofang/Assets/Scenes/sucai01.unity index da51aea7..c0a10ced 100644 --- a/xiaofang/Assets/Scenes/sucai01.unity +++ b/xiaofang/Assets/Scenes/sucai01.unity @@ -2463,6 +2463,37 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 84f9f2b18f8aceb44801fc2ec7ce8f01, type: 3} +--- !u!1 &588795342 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 588795343} + m_Layer: 0 + m_Name: 1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &588795343 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 588795342} + m_LocalRotation: {x: 0, y: 0.70041114, z: 0, w: 0.71373963} + m_LocalPosition: {x: 0, y: 1, z: 29.33} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 176 + m_LocalEulerAnglesHint: {x: 0, y: 88.92, z: 0} --- !u!1001 &593180007 PrefabInstance: m_ObjectHideFlags: 0 @@ -6531,6 +6562,37 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 335b92d98d9b99a40931188cdcf39c39, type: 3} +--- !u!1 &1425267833 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1425267834} + m_Layer: 0 + m_Name: 2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1425267834 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1425267833} + m_LocalRotation: {x: 0, y: 0.70041114, z: 0, w: 0.71373963} + m_LocalPosition: {x: 0.94, y: 1, z: -20.55} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 177 + m_LocalEulerAnglesHint: {x: 0, y: 88.92, z: 0} --- !u!1001 &1425943035 PrefabInstance: m_ObjectHideFlags: 0 @@ -9239,6 +9301,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1888493524} + - component: {fileID: 1888493525} - component: {fileID: 1888493523} - component: {fileID: 1888493522} m_Layer: 0 @@ -9306,14 +9369,29 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1888493521} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalRotation: {x: 0, y: 0.70041114, z: 0, w: 0.71373963} + m_LocalPosition: {x: 0, y: 1, z: 29.33} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 88.92, z: 0} +--- !u!114 &1888493525 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1888493521} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 276124c99c246e840b4970f38c67029e, type: 3} + m_Name: + m_EditorClassIdentifier: + startPoint: {fileID: 588795343} + endPoint: {fileID: 1425267834} + duration: 5 --- !u!1001 &1922936381 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/xiaofang/Assets/Script/Character/CameraControl.cs b/xiaofang/Assets/Script/Character/CameraControl.cs index 2ff4de2a..187257d1 100644 --- a/xiaofang/Assets/Script/Character/CameraControl.cs +++ b/xiaofang/Assets/Script/Character/CameraControl.cs @@ -6,7 +6,7 @@ public class CameraControl : MonoBehaviour { public Transform Character; // 玩家的引用。 public Vector3 pivotOffset = new Vector3(0.0f, 1.7f, 0.0f); // 相机相对于玩家的偏移量,用于调整相机的中心点。 - public Vector3 camOffset = new Vector3(0.2f, 0.2f, -1f); // 相机相对于玩家位置的偏移量,用于定位相机。 + public Vector3 camOffset = new Vector3(0.2f, 0.2f, -1f); // 相机相对于玩家位置的偏移量,用于定位相机。 public float smooth = 10f; // 相机响应的平滑速度。 public float horizontalAimingSpeed = 6f; // 水平转动速度。 public float verticalAimingSpeed = 6f; // 垂直转动速度。 diff --git a/xiaofang/Assets/Script/hylScripts/CameraSmoothMove.cs b/xiaofang/Assets/Script/hylScripts/CameraSmoothMove.cs new file mode 100644 index 00000000..db51e958 --- /dev/null +++ b/xiaofang/Assets/Script/hylScripts/CameraSmoothMove.cs @@ -0,0 +1,29 @@ + using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CameraSmoothMove : MonoBehaviour +{ + + public Transform startPoint; // 起始点 + public Transform endPoint; // 终点 + public float duration = 5f; // 移动所需的时间(秒) + + private float elapsedTime = 0f; // 记录已经过去的时间 + + void Update() + { + // 确保起始点和终点存在 + if (startPoint != null && endPoint != null) + { + // 更新经过的时间 + elapsedTime += Time.deltaTime; + + // 计算摄像机的位置:根据时间比例计算当前位置 + float t = Mathf.Clamp01(elapsedTime / duration); + + // 使用 Lerp 平滑过渡摄像机的位置 + transform.position = Vector3.Lerp(startPoint.position, endPoint.position, t); + } + } +} diff --git a/xiaofang/Assets/Script/hylScripts/CameraSmoothMove.cs.meta b/xiaofang/Assets/Script/hylScripts/CameraSmoothMove.cs.meta new file mode 100644 index 00000000..fbb773ed --- /dev/null +++ b/xiaofang/Assets/Script/hylScripts/CameraSmoothMove.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 276124c99c246e840b4970f38c67029e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: