From ec5a277d184fa2ba4abf938ffd980465a1ccab54 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Sun, 6 Aug 2023 15:02:22 +0200 Subject: [PATCH] proper camera --- Assets/Resources/Games/monkeyWatch.prefab | 57 +++++++++++++++---- .../Scripts/Games/MonkeyWatch/MonkeyWatch.cs | 16 ++++++ 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/Assets/Resources/Games/monkeyWatch.prefab b/Assets/Resources/Games/monkeyWatch.prefab index 3199b1112..dfed4b96e 100644 --- a/Assets/Resources/Games/monkeyWatch.prefab +++ b/Assets/Resources/Games/monkeyWatch.prefab @@ -1584,7 +1584,7 @@ Transform: m_Children: - {fileID: 16600283237656001} m_Father: {fileID: 1686621416582726728} - m_RootOrder: 2 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &870218628151596111 GameObject: @@ -7073,7 +7073,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1093165643910593156} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: -0.05, z: 0} + m_LocalPosition: {x: 0, y: -0.049999997, z: 0} m_LocalScale: {x: 1.68, y: 1.71, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -7137,8 +7137,8 @@ Transform: - {fileID: 3741991241481735311} - {fileID: 161246764106563782} - {fileID: 37240736623304726} - m_Father: {fileID: 1686621416582726728} - m_RootOrder: 3 + m_Father: {fileID: 7676047881968251921} + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1093770155466988112 GameObject: @@ -19585,7 +19585,7 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5940392269407869173} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + 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 @@ -19595,7 +19595,7 @@ Transform: - {fileID: 1937947489430017238} - {fileID: 5830190636956202774} - {fileID: 1585503215860456962} - m_Father: {fileID: 1686621416582726728} + m_Father: {fileID: 7676047881968251921} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &5941324121601745444 @@ -20216,10 +20216,8 @@ Transform: m_LocalScale: {x: 1.3031, y: 1.3031, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 5742479390175277464} - - {fileID: 6857749598573628903} - {fileID: 6302321823436949001} - - {fileID: 3735448262030941676} + - {fileID: 7676047881968251921} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -20238,6 +20236,9 @@ MonoBehaviour: SoundSequences: [] EligibleHits: [] scheduledInputs: [] + cameraAnchor: {fileID: 6302321823436949001} + cameraTransform: {fileID: 16600283237656001} + cameraMoveable: {fileID: 7676047881968251921} --- !u!1 &6181011653585253546 GameObject: m_ObjectHideFlags: 0 @@ -22833,13 +22834,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7415731391529710915} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + 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: - {fileID: 609139906039373078} - m_Father: {fileID: 1686621416582726728} + m_Father: {fileID: 7676047881968251921} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!95 &910339928251400446 @@ -28292,6 +28293,40 @@ Transform: m_Father: {fileID: 5742479390175277464} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &7796175169029263715 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7676047881968251921} + m_Layer: 0 + m_Name: CameraMoveable + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7676047881968251921 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7796175169029263715} + 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: + - {fileID: 5742479390175277464} + - {fileID: 6857749598573628903} + - {fileID: 3735448262030941676} + m_Father: {fileID: 1686621416582726728} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &7904184995463881106 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Games/MonkeyWatch/MonkeyWatch.cs b/Assets/Scripts/Games/MonkeyWatch/MonkeyWatch.cs index 220614885..7a8bc2598 100644 --- a/Assets/Scripts/Games/MonkeyWatch/MonkeyWatch.cs +++ b/Assets/Scripts/Games/MonkeyWatch/MonkeyWatch.cs @@ -26,9 +26,25 @@ namespace HeavenStudio.Games { public static MonkeyWatch instance; + [Header("Components")] + [SerializeField] private Transform cameraAnchor; + [SerializeField] private Transform cameraTransform; + [SerializeField] private Transform cameraMoveable; + private void Awake() { instance = this; + CameraUpdate(); + } + + private void Update() + { + CameraUpdate(); + } + + private void CameraUpdate() + { + cameraMoveable.position = -cameraTransform.position; } } }