From 8c5343ae8058052ea993d97497b0b7b25d9f6d29 Mon Sep 17 00:00:00 2001 From: Pasha Bibko <156938226+PashaBibko@users.noreply.github.com> Date: Tue, 28 Apr 2026 14:05:38 +0100 Subject: [PATCH] Made items be still inside the presser --- Assets/Prefabs/Items/Items.asset | 137 ++++++++++-------- Assets/Scenes/GameScene.unity | 2 +- .../Buildings/Automation/PresserBuilding.cs | 36 ++++- Assets/Scripts/Game/Items/ItemBehaviour.cs | 14 +- 4 files changed, 122 insertions(+), 67 deletions(-) diff --git a/Assets/Prefabs/Items/Items.asset b/Assets/Prefabs/Items/Items.asset index b3e64ea..5d55a92 100644 --- a/Assets/Prefabs/Items/Items.asset +++ b/Assets/Prefabs/Items/Items.asset @@ -17,173 +17,194 @@ MonoBehaviour: CustomBehaviour: 1 Prefab: {fileID: 4062657912758122058, guid: 23e3bfe33d8c6004c85fd638db567ab6, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 2 CustomBehaviour: 1 Prefab: {fileID: 8799415981405337049, guid: c21e0b5539573904cb10d979de4a3f72, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 3 CustomBehaviour: 1 Prefab: {fileID: 4062657912758122058, guid: 5e1f7f5d4294c1d4fa3e6f88dec0dfa6, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 4 CustomBehaviour: 1 Prefab: {fileID: 4062657912758122058, guid: b224b6df33529e64d83245d78e0feb9f, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 5 CustomBehaviour: 1 Prefab: {fileID: 4062657912758122058, guid: 7af455f1c1666e5409156598fe669f74, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 7 CustomBehaviour: 1 Prefab: {fileID: 4062657912758122058, guid: 13f2740b5ae396e40940587ab2effd65, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 8 CustomBehaviour: 1 Prefab: {fileID: 4062657912758122058, guid: ebddb1b81a288cc4c993a25bc9efe894, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 6 CustomBehaviour: 1 Prefab: {fileID: 4062657912758122058, guid: 2cf42dbc57bb6374b9e6ec700aad5854, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 9 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 41d6fc24602553e48b206f2ea7d60bb5, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 11 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 044e3c59048f2ec4db0a06bcabc676b0, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 19 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 1d1c1945744668945abc5ea0f9a4c760, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 20 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: f2420d92fef5dde46ba12236e8315458, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 18 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: e1b896c45d0dc394eb584c739794ff21, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 17 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: c5580241b3a654e47a270fc00407cbd4, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 15 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 2125bd42c9c45584b9c2ed2d6421e410, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 10 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 45b8d9d3353ed7c4e8fd11c6387d2364, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 16 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: b2ad6f08a32678344aa95ae220e3d030, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 29 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 46e1f4f05a477b046a5d8121bb63388d, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 28 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 7ba70ccf373f1064a9911798bc1748ce, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 12 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 9fc502b6f85c8764ab181f64c646bcf1, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 21 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 0ff4ad3b26e30d14286f45c67ce8ea91, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 23 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: eb6cbc0d308433642a3157f5afe2b17e, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 22 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 642bb664840379a46b4dff87e65e229d, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 24 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 5e2046530547f3a4f807e051d6e1da05, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 26 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: e37376b2f30b7d64fa634df2233ff9ab, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 14 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 082386cfbe8dfc34189664a1dd37ede4, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 25 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: d0fc612fb6777b14b88133b4cd485733, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 27 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: f74988e3ad5daf64f8f6c6adab75c984, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 - Type: 13 CustomBehaviour: 0 Prefab: {fileID: 4485779862959683977, guid: 30a47cb0b048fe14aad8715a93340ea7, type: 3} - MinMoney: 1 - MaxMoney: 5 + BaseItemValue: 0 + - Type: 35 + CustomBehaviour: 0 + Prefab: {fileID: 4485779862959683977, guid: 9f42b3ba87a20c44ab1d42f2ccb5e8a9, + type: 3} + BaseItemValue: 0 + - Type: 30 + CustomBehaviour: 0 + Prefab: {fileID: 4485779862959683977, guid: 6116435b2f552b645bb108b557d9f260, + type: 3} + BaseItemValue: 0 + - Type: 36 + CustomBehaviour: 0 + Prefab: {fileID: 4485779862959683977, guid: c122bad889bd0e940ac04774d2931c43, + type: 3} + BaseItemValue: 0 + - Type: 37 + CustomBehaviour: 0 + Prefab: {fileID: 4485779862959683977, guid: fca748809ae1f854a8be34fc012871ff, + type: 3} + BaseItemValue: 0 + - Type: 32 + CustomBehaviour: 0 + Prefab: {fileID: 4485779862959683977, guid: 64672e82b5d249243be99685f35256ad, + type: 3} + BaseItemValue: 0 + - Type: 33 + CustomBehaviour: 0 + Prefab: {fileID: 4485779862959683977, guid: e8214f8bfefe02445a6377c51119e395, + type: 3} + BaseItemValue: 0 + - Type: 34 + CustomBehaviour: 0 + Prefab: {fileID: 4485779862959683977, guid: e0a24b112aaff3144877104e77013959, + type: 3} + BaseItemValue: 0 + - Type: 31 + CustomBehaviour: 0 + Prefab: {fileID: 4485779862959683977, guid: c9b060e21a993cd4682f148bba5a95d1, + type: 3} + BaseItemValue: 0 + - Type: 38 + CustomBehaviour: 0 + Prefab: {fileID: 4485779862959683977, guid: d1fe84a0b94bf2d4189838f4031a0f0b, + type: 3} + BaseItemValue: 0 + - Type: 39 + CustomBehaviour: 0 + Prefab: {fileID: 4485779862959683977, guid: 592db5119c3d5c74981f7a8fdb975217, + type: 3} + BaseItemValue: 0 diff --git a/Assets/Scenes/GameScene.unity b/Assets/Scenes/GameScene.unity index e7ee851..e686f7f 100644 --- a/Assets/Scenes/GameScene.unity +++ b/Assets/Scenes/GameScene.unity @@ -1463,8 +1463,8 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_ConstrainProportionsScale: 1 m_Children: - - {fileID: 2005593404} - {fileID: 1944344878} + - {fileID: 2005593404} - {fileID: 2112507919} - {fileID: 2026916298} - {fileID: 96288173} diff --git a/Assets/Scripts/Game/Buildings/Automation/PresserBuilding.cs b/Assets/Scripts/Game/Buildings/Automation/PresserBuilding.cs index bbbc2d7..b66c74a 100644 --- a/Assets/Scripts/Game/Buildings/Automation/PresserBuilding.cs +++ b/Assets/Scripts/Game/Buildings/Automation/PresserBuilding.cs @@ -60,8 +60,40 @@ namespace Fruitomation.Game } [Preserve, UsedImplicitly] public void OpenTop() => TopCollider.enabled = false; - [Preserve, UsedImplicitly] public void CloseTop() => TopCollider.enabled = true; - [Preserve, UsedImplicitly] public void OpenBottom() => BottomCollider.enabled = false; + + [Preserve, UsedImplicitly] + public void CloseTop() + { + TopCollider.enabled = true; + foreach (GameObject go in CurrentContainedObjects) + { + bool isItem = go.transform.parent.TryGetComponent(out ItemBehaviour item); + if (!isItem) + { + return; + } + + item.SendToLimbo(); + } + } + + + [Preserve, UsedImplicitly] + public void OpenBottom() + { + BottomCollider.enabled = false; + foreach (GameObject go in CurrentContainedObjects) + { + bool isItem = go.transform.parent.TryGetComponent(out ItemBehaviour item); + if (!isItem) + { + return; + } + + item.HealLimboState(); + } + } + [Preserve, UsedImplicitly] public void CloseBottom() => BottomCollider.enabled = true; [Preserve, UsedImplicitly] public void Press() diff --git a/Assets/Scripts/Game/Items/ItemBehaviour.cs b/Assets/Scripts/Game/Items/ItemBehaviour.cs index 69f243e..36e8ce4 100644 --- a/Assets/Scripts/Game/Items/ItemBehaviour.cs +++ b/Assets/Scripts/Game/Items/ItemBehaviour.cs @@ -39,22 +39,24 @@ namespace Fruitomation.Game.Items private IEnumerator SendToGhostRealmInternal() { - Sleep(); + CurrentChild.SetActive(false); + Body2D.Sleep(); + yield return new WaitForSeconds(0.5f); - WakeUp(); + + CurrentChild.SetActive(true); + Body2D.WakeUp(); } public void SendToTheGhostRealm() => StartCoroutine(SendToGhostRealmInternal()); - public void Sleep() + public void SendToLimbo() { - CurrentChild.SetActive(false); Body2D.Sleep(); } - public void WakeUp() + public void HealLimboState() { - CurrentChild.SetActive(true); Body2D.WakeUp(); }