diff --git a/Assets/SWPPT3/Prefabs/ManagerObject/GameManager.prefab b/Assets/SWPPT3/Prefabs/ManagerObject/GameManager.prefab index 61dec6a1..dae8b8df 100644 --- a/Assets/SWPPT3/Prefabs/ManagerObject/GameManager.prefab +++ b/Assets/SWPPT3/Prefabs/ManagerObject/GameManager.prefab @@ -9,7 +9,7 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 6404462614507032101} - - component: {fileID: 6404462614507032100} + - component: {fileID: 8718208846313316995} m_Layer: 0 m_Name: GameManager m_TagString: Untagged @@ -25,14 +25,14 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6404462614507032103} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 411.38785, y: 231.10301, z: 0.17117564} 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} ---- !u!114 &6404462614507032100 +--- !u!114 &8718208846313316995 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -44,4 +44,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 98767ffb1155413dbb0d3f67fd4f2848, type: 3} m_Name: m_EditorClassIdentifier: - stageNumber: 1 + _stageManager: {fileID: 0} + _onTryingLoadStatusChanged: + m_PersistentCalls: + m_Calls: [] diff --git a/Assets/SWPPT3/Prefabs/UI/Overlay/StartScreen.prefab b/Assets/SWPPT3/Prefabs/UI/Overlay/StartScreen.prefab index 9702b1ac..5436079f 100644 --- a/Assets/SWPPT3/Prefabs/UI/Overlay/StartScreen.prefab +++ b/Assets/SWPPT3/Prefabs/UI/Overlay/StartScreen.prefab @@ -33,10 +33,10 @@ RectTransform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 100, y: 100} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &4594056759085863215 GameObject: @@ -100,7 +100,7 @@ MonoBehaviour: m_Color: {r: 0, g: 0, b: 0, a: 0.9411765} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 + m_Maskable: 0 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] diff --git a/Assets/SWPPT3/Prefabs/UI/Screen/InGame.prefab b/Assets/SWPPT3/Prefabs/UI/Screen/InGame.prefab index 35714150..18be91d1 100644 --- a/Assets/SWPPT3/Prefabs/UI/Screen/InGame.prefab +++ b/Assets/SWPPT3/Prefabs/UI/Screen/InGame.prefab @@ -2755,7 +2755,7 @@ RectTransform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 3061622423582226959} - 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 @@ -2867,6 +2867,9 @@ MonoBehaviour: _metalNumTmp: {fileID: 2895323979621877206} _rubberNumTmp: {fileID: 818430995981542076} _radialUI: {fileID: 8488859834885466518} + _rubberButton: {fileID: 8488859835809235302} + _metalButton: {fileID: 8488859835077312272} + _slimeButton: {fileID: 8488859835786804939} --- !u!1 &4169080372856693958 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/SWPPT3/Scenes/Start.unity b/Assets/SWPPT3/Scenes/Start.unity index e2ae8ac1..557fecba 100644 --- a/Assets/SWPPT3/Scenes/Start.unity +++ b/Assets/SWPPT3/Scenes/Start.unity @@ -122,6 +122,150 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1001 &90613296 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 630443866} + m_Modifications: + - target: {fileID: 4594056758955674281, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_Name + value: StartScreen + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674281, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056758955674282, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4594056759085863201, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_Color.a + value: 0.9411765 + objectReference: {fileID: 0} + - target: {fileID: 4594056759085863201, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_Maskable + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4594056759085863201, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_RaycastTarget + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4594056759085863202, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + propertyPath: m_CullTransparentMesh + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: d79180819b10a49f88d89a3e3c2f6d2c, type: 3} --- !u!4 &107014579 stripped Transform: m_CorrespondingSourceObject: {fileID: 9056323883095744318, guid: 7dc6145198fcbe141979e3c299fe64da, @@ -265,6 +409,12 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d37cf5fc0653f4c20a0358100695c9a2, type: 3} +--- !u!224 &630443866 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + m_PrefabInstance: {fileID: 1443968232} + m_PrefabAsset: {fileID: 0} --- !u!1001 &682943423 PrefabInstance: m_ObjectHideFlags: 0 @@ -491,8 +641,177 @@ PrefabInstance: propertyPath: m_Name value: GameManager objectReference: {fileID: 0} + - target: {fileID: 8718208846313316995, guid: 347b8b9888ae21c4f8ee0ee501b8a0c0, + type: 3} + propertyPath: _onTryingLoadStatusChanged.m_PersistentCalls.m_Calls.Array.size + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8718208846313316995, guid: 347b8b9888ae21c4f8ee0ee501b8a0c0, + type: 3} + propertyPath: _onTryingLoadStatusChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8718208846313316995, guid: 347b8b9888ae21c4f8ee0ee501b8a0c0, + type: 3} + propertyPath: _onTryingLoadStatusChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Target + value: + objectReference: {fileID: 2054816394} + - target: {fileID: 8718208846313316995, guid: 347b8b9888ae21c4f8ee0ee501b8a0c0, + type: 3} + propertyPath: _onTryingLoadStatusChanged.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 8718208846313316995, guid: 347b8b9888ae21c4f8ee0ee501b8a0c0, + type: 3} + propertyPath: _onTryingLoadStatusChanged.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName + value: SetActive + objectReference: {fileID: 0} + - target: {fileID: 8718208846313316995, guid: 347b8b9888ae21c4f8ee0ee501b8a0c0, + type: 3} + propertyPath: _onTryingLoadStatusChanged.m_PersistentCalls.m_Calls.Array.data[0].m_TargetAssemblyTypeName + value: UnityEngine.GameObject, UnityEngine + objectReference: {fileID: 0} + - target: {fileID: 8718208846313316995, guid: 347b8b9888ae21c4f8ee0ee501b8a0c0, + type: 3} + propertyPath: _onTryingLoadStatusChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_BoolArgument + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8718208846313316995, guid: 347b8b9888ae21c4f8ee0ee501b8a0c0, + type: 3} + propertyPath: _onTryingLoadStatusChanged.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_ObjectArgumentAssemblyTypeName + value: UnityEngine.Object, UnityEngine + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 347b8b9888ae21c4f8ee0ee501b8a0c0, type: 3} +--- !u!1001 &1443968232 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1956572137} + m_Modifications: + - target: {fileID: 519183602932949858, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_Name + value: MainCanvas + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_Pivot.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865086, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865087, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_SortingOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4136735327766865087, guid: ffc3b6723b081b145ac40f5f139b7898, + type: 3} + propertyPath: m_TargetDisplay + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ffc3b6723b081b145ac40f5f139b7898, type: 3} --- !u!1001 &1449402931 PrefabInstance: m_ObjectHideFlags: 0 @@ -685,6 +1004,7 @@ Transform: m_Children: - {fileID: 692768423} - {fileID: 107014579} + - {fileID: 630443866} m_Father: {fileID: 0} m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -762,6 +1082,12 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b3ea1b38601fb2241ab4113dc2c38e41, type: 3} +--- !u!1 &2054816394 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 4594056758955674281, guid: d79180819b10a49f88d89a3e3c2f6d2c, + type: 3} + m_PrefabInstance: {fileID: 90613296} + m_PrefabAsset: {fileID: 0} --- !u!1001 &2140767895 PrefabInstance: m_ObjectHideFlags: 0 @@ -1404,11 +1730,21 @@ PrefabInstance: propertyPath: m_AnchorMax.y value: 0 objectReference: {fileID: 0} + - target: {fileID: 4631719241790745394, guid: d75084c0538324141925deab3531a83d, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 4924722160105393931, guid: d75084c0538324141925deab3531a83d, type: 3} propertyPath: m_Name value: Title objectReference: {fileID: 0} + - target: {fileID: 4924722160105393931, guid: d75084c0538324141925deab3531a83d, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 6205114681952235223, guid: d75084c0538324141925deab3531a83d, type: 3} propertyPath: m_AnchorMax.x diff --git a/Assets/SWPPT3/Scripts/Main/Manager/GameManager.cs b/Assets/SWPPT3/Scripts/Main/Manager/GameManager.cs index a0702e11..65d58be8 100644 --- a/Assets/SWPPT3/Scripts/Main/Manager/GameManager.cs +++ b/Assets/SWPPT3/Scripts/Main/Manager/GameManager.cs @@ -4,6 +4,7 @@ using SWPPT3.Main.StageDirector; using UnityEditor.SceneManagement; using UnityEngine; +using UnityEngine.Events; using UnityEngine.SceneManagement; namespace SWPPT3.Main.Manager @@ -44,11 +45,12 @@ public GameState GameState public int StageNumber { get => stageNumber; set => stageNumber = value; } public StageManager _stageManager; + [SerializeField] private UnityEvent _onTryingLoadStatusChanged; public void Awake() { - + _onTryingLoadStatusChanged.Invoke(false); } @@ -62,9 +64,11 @@ private void HandleGameStateChanged(GameState newState) // UIManager.Instance.ShowStartStage(); break; case GameState.Ready: + _onTryingLoadStatusChanged.Invoke(true); LoadScene(); break; case GameState.Playing: + _onTryingLoadStatusChanged.Invoke(false); _stageManager.ResumeStage(); break; case GameState.Paused: diff --git a/Assets/SWPPT3/Scripts/Main/StageDirector/StageManager.cs b/Assets/SWPPT3/Scripts/Main/StageDirector/StageManager.cs index 296c9366..8189621b 100644 --- a/Assets/SWPPT3/Scripts/Main/StageDirector/StageManager.cs +++ b/Assets/SWPPT3/Scripts/Main/StageDirector/StageManager.cs @@ -4,6 +4,7 @@ using SWPPT3.Main.Utility.Singleton; using UnityEditor.SceneManagement; using UnityEngine; +using UnityEngine.Events; namespace SWPPT3.Main.StageDirector { diff --git a/Assets/SWPPT3/Scripts/Main/UI/InGameScreenBehaviour.cs b/Assets/SWPPT3/Scripts/Main/UI/InGameScreenBehaviour.cs index 383f66e6..99950295 100644 --- a/Assets/SWPPT3/Scripts/Main/UI/InGameScreenBehaviour.cs +++ b/Assets/SWPPT3/Scripts/Main/UI/InGameScreenBehaviour.cs @@ -4,6 +4,7 @@ using SWPPT3.Main.PlayerLogic; using SWPPT3.Main.PlayerLogic.State; using TMPro; +using UnityEditor; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; @@ -26,6 +27,12 @@ public class InGameScreenBehaviour : MonoBehaviour [SerializeField] private TextMeshProUGUI _rubberNumTmp; [SerializeField] private GameObject _radialUI; + [SerializeField] private RectTransform _rubberButton; + [SerializeField] private RectTransform _metalButton; + [SerializeField] private RectTransform _slimeButton; + private float _maxDistance = 200f; // 최대 거리 (이 값에 따라 확대 감도가 달라짐) + private Vector2 _screenCenter; + public void ClickResume() { @@ -74,11 +81,9 @@ public void ChangeRubber() public void ShowRadialUI() { _radialUI.SetActive(true); - Debug.Log($"{_player.Item[PlayerStates.Rubber]} {_player.Item[PlayerStates.Metal]}"); if (_player.Item[PlayerStates.Rubber] == 0) { _radialUI.transform.Find("RightButton/RightActive").gameObject.SetActive(false); - } else { @@ -94,6 +99,52 @@ public void ShowRadialUI() _radialUI.transform.Find("LeftButton/LeftActive").gameObject.SetActive(true); } } + private void UpdateRadialScale() + { + Vector2 mousePosition = Mouse.current.position.ReadValue(); + UpdateButtonScale(); + } + + private void UpdateButtonScale() + { + Vector2 screenCenter = new Vector2(Screen.width / 2f, Screen.height / 2f); + Vector2 relativePos = Mouse.current.position.ReadValue() - screenCenter; + if (relativePos.magnitude < 70f) return; + + float angle = Mathf.Atan2(relativePos.y, relativePos.x) * Mathf.Rad2Deg; + if (angle < 0) angle += 360f; + + float scaleFactor = Mathf.Lerp(3.0f, 1.0f, relativePos.magnitude / _maxDistance); + scaleFactor = Mathf.Clamp(scaleFactor, 1.0f, 3.0f); + + if (angle >= 0 && angle < 120) + { + SetButtonScale(_slimeButton, scaleFactor); + SetButtonScale(_metalButton, 1.0f); + SetButtonScale(_rubberButton, 1.0f); + } + else if (angle >= 120 && angle < 240) + { + SetButtonScale(_metalButton, scaleFactor); + SetButtonScale(_rubberButton, 1.0f); + SetButtonScale(_slimeButton, 1.0f); + } + else + { + SetButtonScale(_rubberButton, scaleFactor); + SetButtonScale(_metalButton, 1.0f); + SetButtonScale(_slimeButton, 1.0f); + } + } + + private void SetButtonScale(RectTransform button, float scale) + { + if (button.gameObject.activeSelf) + { + button.localScale = new Vector3(scale, scale, 1.0f); + } + } + public void PlayTimeUpdate(int time){ int min = time/60; @@ -152,6 +203,10 @@ void Update() { _onTryingLoadStatusChanged.Invoke(false); } + if (GameManager.Instance.GameState == GameState.OnChoice) + { + UpdateRadialScale(); + } } private void HandleEsc() { @@ -195,6 +250,7 @@ private void CheckRadial() Vector2 cursorPos = Mouse.current.position.ReadValue(); Vector2 screenCenter = new Vector2(Screen.width / 2f, Screen.height / 2f); Vector2 relativePos = cursorPos - screenCenter; + if (relativePos.magnitude < 50f) return; float angle = Mathf.Atan2(relativePos.y, relativePos.x) * Mathf.Rad2Deg; if (angle < 0) { diff --git a/Assets/SWPPT3/Scripts/Main/UI/PlayingScreenBehavior.cs b/Assets/SWPPT3/Scripts/Main/UI/PlayingScreenBehavior.cs new file mode 100644 index 00000000..7cc90eda --- /dev/null +++ b/Assets/SWPPT3/Scripts/Main/UI/PlayingScreenBehavior.cs @@ -0,0 +1,101 @@ +using System.Collections; +using System.Collections.Generic; +using SWPPT3.Main.Manager; +using SWPPT3.Main.PlayerLogic; +using SWPPT3.Main.PlayerLogic.State; +using UnityEngine; +using UnityEngine.InputSystem; + +public class PlayingScreenBehavior : MonoBehaviour +{ + public Player _player; + public GameObject _radialUI; + + private void Awake() + { + Cursor.visible = false; + if (InputManager.Instance != null) + { + InputManager.Instance.OnStartTransform += HandleTransform; + } + } + + private void HandleTransform(bool isClick) + { + if (GameManager.Instance.GameState == GameState.Playing && isClick) + { + Debug.Log(GameManager.Instance.GameState); + _radialUI.SetActive(true); + Cursor.visible = true; + Cursor.lockState = CursorLockMode.None; + + // 커서를 화면 중앙으로 이동 + Vector2 screenCenter = new Vector2(Screen.width / 2f, Screen.height / 2f); + + Mouse.current.WarpCursorPosition(screenCenter); + + GameManager.Instance.GameState = GameState.OnChoice; + ShowRadialUI(); + } + else if (GameManager.Instance.GameState == GameState.OnChoice && !isClick) + { + checkRadial(); + Cursor.visible = false; + Cursor.lockState = CursorLockMode.Locked; + GameManager.Instance.GameState = GameState.Playing; + HideRadialUI(); + } + } + + private void checkRadial() + { + Vector2 cursorPos = Mouse.current.position.ReadValue(); + Vector2 screenCenter = new Vector2(Screen.width / 2f, Screen.height / 2f); + Vector2 relativePos = cursorPos - screenCenter; + float angle = Mathf.Atan2(relativePos.y, relativePos.x) * Mathf.Rad2Deg; + if (angle < 0) + { + angle += 360f; + } + + if (angle >= 0 && angle < 120) + { + _player.TryChangeState(PlayerStates.Rubber); + } + else if (angle >= 120 && angle < 240) + { + _player.TryChangeState(PlayerStates.Metal); + } + else + { + _player.TryChangeState(PlayerStates.Slime); + } + } + + public void HideRadialUI() + { + _radialUI.SetActive(false); + } + + public void ShowRadialUI() + { + _radialUI.SetActive(true); + if (_player.Item[PlayerStates.Rubber] == 0) + { + _radialUI.transform.Find("RightButton/RightActive").gameObject.SetActive(false); + } + else + { + _radialUI.transform.Find("RightButton/RightActive").gameObject.SetActive(true); + + if (_player.Item[PlayerStates.Metal] == 0) + { + _radialUI.transform.Find("LeftButton/LeftActive").gameObject.SetActive(false); + } + else + { + _radialUI.transform.Find("LeftButton/LeftActive").gameObject.SetActive(true); + } + } + } +} diff --git a/Assets/SWPPT3/Scripts/Main/UI/PlayingScreenBehavior.cs.meta b/Assets/SWPPT3/Scripts/Main/UI/PlayingScreenBehavior.cs.meta new file mode 100644 index 00000000..7fef9936 --- /dev/null +++ b/Assets/SWPPT3/Scripts/Main/UI/PlayingScreenBehavior.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ecad2364cf7dff4ab2e7516aede420e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: