From 6d26efe67c11d31236481ff91195e75261c1b1a7 Mon Sep 17 00:00:00 2001 From: Vladimir Koshevarov Date: Mon, 13 Mar 2023 13:31:17 +0200 Subject: [PATCH] change in camera system. move it far on the street an follow the player --- Assets/Scenes/City.unity | 28 ++++++++++++++-------------- Assets/Scripts/CameraSystem.cs | 28 ++++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Assets/Scenes/City.unity b/Assets/Scenes/City.unity index d3e8314c..4876c797 100644 --- a/Assets/Scenes/City.unity +++ b/Assets/Scenes/City.unity @@ -1343,7 +1343,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_BindingMode: 4 - m_FollowOffset: {x: 0, y: 9, z: -4} + m_FollowOffset: {x: 0, y: 15, z: -7} m_XDamping: 0.1 m_YDamping: 0.1 m_ZDamping: 0.1 @@ -2448,8 +2448,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 50} + m_AnchoredPosition: {x: 182.005, y: 0} + m_SizeDelta: {x: 364.01, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &771379432 MonoBehaviour: @@ -2527,7 +2527,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 182.005, y: 0} m_SizeDelta: {x: 0, y: 70} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &815467878 @@ -2957,7 +2957,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 882.17, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &927596948 @@ -3246,7 +3246,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 628.58496, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &952219226 @@ -3387,8 +3387,8 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 963194225} - m_LocalRotation: {x: 0.54491353, y: 0.00000002885483, z: -0.00000001875198, w: 0.8384923} - m_LocalPosition: {x: 29.11, y: 9, z: -54.39} + m_LocalRotation: {x: 0.53717524, y: 0.00000001592945, z: -0.000000010144878, w: 0.8434707} + m_LocalPosition: {x: 29.11, y: 15, z: -57.39} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -9533,7 +9533,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 20, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1503626360 @@ -10825,7 +10825,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 260, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1811096135 @@ -11047,7 +11047,7 @@ PrefabInstance: - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 182.005 objectReference: {fileID: 0} - target: {fileID: 3806516704876462308, guid: ea47665625ccfd4408f6411caf45f910, type: 3} @@ -11370,7 +11370,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 182.005, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1964284071 @@ -12170,8 +12170,8 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2110938951} - m_LocalRotation: {x: 0.54491353, y: 0.00000002885483, z: -0.00000001875198, w: 0.8384923} - m_LocalPosition: {x: 29.11, y: 9, z: -54.39} + m_LocalRotation: {x: 0.53717524, y: 0.00000001592945, z: -0.000000010144878, w: 0.8434707} + m_LocalPosition: {x: 29.11, y: 15, z: -57.39} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: diff --git a/Assets/Scripts/CameraSystem.cs b/Assets/Scripts/CameraSystem.cs index b624582a..047ac219 100644 --- a/Assets/Scripts/CameraSystem.cs +++ b/Assets/Scripts/CameraSystem.cs @@ -10,23 +10,23 @@ public class CameraSystem : MonoBehaviour private void Start() { - transform.position = Player.Instance.transform.position; - //_camera.LookAt = Player.Instance.transform; - //_camera.Follow = Player.Instance.transform; + //transform.position = Player.Instance.transform.position; + _camera.LookAt = Player.Instance.transform; + _camera.Follow = Player.Instance.transform; } - private void Update() - { - Vector3 inputDir = Vector3.zero; + //private void Update() + //{ + // Vector3 inputDir = Vector3.zero; - if (Input.GetKey(KeyCode.W)) inputDir.z = +1f; - if (Input.GetKey(KeyCode.S)) inputDir.z = -1f; - if (Input.GetKey(KeyCode.A)) inputDir.x = -1f; - if (Input.GetKey(KeyCode.D)) inputDir.x = +1f; + // if (Input.GetKey(KeyCode.W)) inputDir.z = +1f; + // if (Input.GetKey(KeyCode.S)) inputDir.z = -1f; + // if (Input.GetKey(KeyCode.A)) inputDir.x = -1f; + // if (Input.GetKey(KeyCode.D)) inputDir.x = +1f; - Vector3 moveDir = transform.forward * inputDir.z + transform.right * inputDir.x; + // Vector3 moveDir = transform.forward * inputDir.z + transform.right * inputDir.x; - //if (moveDir == Vector3.zero && Player.Instance.stat) transform.position = Player.Instance.transform.position; - transform.position += moveDir * _moveSpeed * Time.deltaTime; - } + // //if (moveDir == Vector3.zero && Player.Instance.stat) transform.position = Player.Instance.transform.position; + // transform.position += moveDir * _moveSpeed * Time.deltaTime; + //} }