Made items be still inside the presser

This commit is contained in:
Pasha Bibko
2026-04-28 14:05:38 +01:00
parent b17229bb1c
commit 8c5343ae80
4 changed files with 122 additions and 67 deletions

View File

@@ -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()

View File

@@ -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();
}