diff --git a/Assets/Resources/Games/karateman.prefab b/Assets/Resources/Games/karateman.prefab index 79fe03c1..06be357f 100644 --- a/Assets/Resources/Games/karateman.prefab +++ b/Assets/Resources/Games/karateman.prefab @@ -668,7 +668,7 @@ SpriteRenderer: m_Size: {x: 17.777779, y: 10} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 + m_WasSpriteAssigned: 0 m_MaskInteraction: 0 m_SpriteSortPoint: 0 --- !u!1 &2786846297550947310 @@ -6598,7 +6598,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 60 + m_SortingOrder: 50 m_Sprite: {fileID: -348202296468608855, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 @@ -17651,7 +17651,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 60 + m_SortingOrder: 50 m_Sprite: {fileID: -348202296468608855, guid: 868cd67f05ca7c646bae00fcc2ba7eaa, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 diff --git a/Assets/Scripts/Games/KarateMan/Pot.cs b/Assets/Scripts/Games/KarateMan/Pot.cs index 05b5cbd9..cdd2e93b 100644 --- a/Assets/Scripts/Games/KarateMan/Pot.cs +++ b/Assets/Scripts/Games/KarateMan/Pot.cs @@ -15,7 +15,9 @@ namespace RhythmHeavenMania.Games.KarateMan public GameObject Holder; private GameObject newHolder; public GameObject Sprite; + private SpriteRenderer spriteComp; public GameObject Shadow; + private SpriteRenderer shadowSpriteComp; public bool isThrown; public bool isHit = false; @@ -54,6 +56,8 @@ namespace RhythmHeavenMania.Games.KarateMan private void Start() { anim = GetComponent(); + spriteComp = Sprite.GetComponent(); + shadowSpriteComp = Shadow.GetComponent(); Sprite.transform.eulerAngles = new Vector3(0, 0, Random.Range(0, 360)); @@ -82,7 +86,7 @@ namespace RhythmHeavenMania.Games.KarateMan PlayerActionInit(this.gameObject, createBeat); - Sprite.GetComponent().enabled = false; + spriteComp.enabled = false; } public override void OnAce() @@ -108,9 +112,9 @@ namespace RhythmHeavenMania.Games.KarateMan private void Update() { if (Conductor.instance.songPositionInBeats >= createBeat) - Sprite.GetComponent().enabled = true; + spriteComp.enabled = true; else - Sprite.GetComponent().enabled = false; + spriteComp.enabled = false; float time2Destroy = Conductor.instance.GetLoopPositionFromBeat(createBeat, 4); @@ -194,8 +198,13 @@ namespace RhythmHeavenMania.Games.KarateMan if (normalizedBeat > 1) { - Sprite.GetComponent().sortingOrder = -20; - Shadow.GetComponent().sortingOrder = -30; + spriteComp.sortingOrder = -20; + shadowSpriteComp.sortingOrder = -30; + } + else + { + // Pots closer to Joe are sorted further back. + spriteComp.sortingOrder = 60 - Mathf.RoundToInt(10f * normalizedBeat); } } @@ -279,7 +288,7 @@ namespace RhythmHeavenMania.Games.KarateMan isThrown = false; isHit = true; - Sprite.GetComponent().sortingOrder = 49; + spriteComp.sortingOrder = 49; } public void Miss() @@ -295,7 +304,7 @@ namespace RhythmHeavenMania.Games.KarateMan isHit = false; isThrown = false; anim.enabled = false; - Sprite.GetComponent().sortingOrder = 49; + spriteComp.sortingOrder = 49; } private void NewHolder()