This commit is contained in:
RochesterX
2025-04-07 18:56:43 -04:00
parent 1bdf8b5280
commit 54ee154807
2 changed files with 19 additions and 4 deletions

View File

@@ -17,9 +17,17 @@ public class FallPlatform : MonoBehaviour
}
private void OnTriggerEnter2D(Collider2D collision) // Makes platform fall when player or another platform touch it
{
if (!falling && (collision.gameObject.CompareTag("Player") || collision.transform.GetChild(0).TryGetComponent(out FallPlatform _)))
try
{
StartCoroutine(FallAfterDelay());
if (collision.transform.childCount != 0 && !falling && (collision.gameObject.CompareTag("Player") || collision.transform.GetChild(0).TryGetComponent(out FallPlatform _)))
{
StartCoroutine(FallAfterDelay());
}
}
catch (System.Exception e)
{
Debug.LogError("Error in FallPlatform: " + e.Message);
}
}