From a05047e08b224e674fb5fc156f63539339286515 Mon Sep 17 00:00:00 2001 From: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com> Date: Mon, 7 Aug 2023 23:20:50 +0200 Subject: [PATCH] fixed layering --- .../Prefabs/Games/MonkeyWatch/YellowMonkey.prefab | 13 +++++++++++++ .../Prefabs/Games/MonkeyWatch/watchHole.prefab | 12 ------------ .../Scripts/Games/MonkeyWatch/WatchMonkeyHandler.cs | 11 +++-------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Assets/Resources/Prefabs/Games/MonkeyWatch/YellowMonkey.prefab b/Assets/Resources/Prefabs/Games/MonkeyWatch/YellowMonkey.prefab index 3ae89e97b..45cca4c94 100644 --- a/Assets/Resources/Prefabs/Games/MonkeyWatch/YellowMonkey.prefab +++ b/Assets/Resources/Prefabs/Games/MonkeyWatch/YellowMonkey.prefab @@ -179,6 +179,7 @@ GameObject: - component: {fileID: 7591110402097765485} - component: {fileID: 7211266264008123551} - component: {fileID: -9193613041847046406} + - component: {fileID: -7082706312707440325} m_Layer: 0 m_Name: YellowMonkey m_TagString: Untagged @@ -244,6 +245,18 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: isPink: 0 + monkeyBeat: 0 +--- !u!210 &-7082706312707440325 +SortingGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3151069026564347634} + m_Enabled: 1 + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 50 --- !u!1 &4343136497418508153 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Prefabs/Games/MonkeyWatch/watchHole.prefab b/Assets/Resources/Prefabs/Games/MonkeyWatch/watchHole.prefab index 391c49604..4c3a694b9 100644 --- a/Assets/Resources/Prefabs/Games/MonkeyWatch/watchHole.prefab +++ b/Assets/Resources/Prefabs/Games/MonkeyWatch/watchHole.prefab @@ -178,7 +178,6 @@ GameObject: m_Component: - component: {fileID: 2594505700513810575} - component: {fileID: 4157700164771259173} - - component: {fileID: 6295735035881919980} m_Layer: 0 m_Name: watchHole m_TagString: Untagged @@ -224,14 +223,3 @@ Animator: m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorStateOnDisable: 0 m_WriteDefaultValuesOnDisable: 0 ---- !u!210 &6295735035881919980 -SortingGroup: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8325540476350084961} - m_Enabled: 1 - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 diff --git a/Assets/Scripts/Games/MonkeyWatch/WatchMonkeyHandler.cs b/Assets/Scripts/Games/MonkeyWatch/WatchMonkeyHandler.cs index 2dc156fea..c7033dd75 100644 --- a/Assets/Scripts/Games/MonkeyWatch/WatchMonkeyHandler.cs +++ b/Assets/Scripts/Games/MonkeyWatch/WatchMonkeyHandler.cs @@ -25,17 +25,9 @@ namespace HeavenStudio.Games.Scripts_MonkeyWatch private void Awake() { game = MonkeyWatch.instance; - int sortIndex = 0; - bool goDown = false; for (int i = 0; i < 60; i++) { watchHoles.Add(transform.GetChild(i)); - watchHoles[i].GetComponent().sortingOrder = sortIndex; - sortIndex += goDown ? -1 : 1; - if (sortIndex >= 30) - { - goDown = true; - } } } @@ -63,6 +55,9 @@ namespace HeavenStudio.Games.Scripts_MonkeyWatch WatchMonkey spawnedMonkey = Instantiate(isPink ? pinkMonkeyRef : yellowMonkeyRef, hole); spawnedMonkey.Appear(beat, instant, hole.GetComponent(), GetMonkeyAngle(index)); spawnedMonkey.transform.eulerAngles = Vector3.zero; + var sortingGroup = spawnedMonkey.GetComponent(); + if (index <= 30) sortingGroup.sortingOrder = 50 + watchHoleIndex; + else sortingGroup.sortingOrder = 50 + watchHoleIndex - (watchHoleIndex - 29); currentMonkeys.Add(spawnedMonkey); if (currentMonkeys.Count > maxMonkeys) {