Poop obstacle pipeline working

This commit is contained in:
Michal Pikulski
2025-11-21 11:33:49 +01:00
parent b4b17c18ed
commit e9320c6d03
20 changed files with 1341 additions and 371 deletions

View File

@@ -21,6 +21,12 @@ namespace Minigames.BirdPooper
{
base.OnManagedAwake();
// Tag as Projectile for target detection
if (!gameObject.CompareTag("Projectile"))
{
gameObject.tag = "Projectile";
}
// Load settings
settings = GameManager.GetSettingsObject<IBirdPooperSettings>();
if (settings == null)
@@ -37,16 +43,19 @@ namespace Minigames.BirdPooper
Rigidbody2D rb = GetComponent<Rigidbody2D>();
if (rb != null)
{
rb.bodyType = RigidbodyType2D.Dynamic;
rb.gravityScale = 0f; // Manual gravity
rb.bodyType = RigidbodyType2D.Kinematic; // Kinematic = manual control, no physics
rb.collisionDetectionMode = CollisionDetectionMode2D.Continuous;
}
// Verify collider is trigger (for target detection in Phase 5)
Collider2D col = GetComponent<Collider2D>();
if (col != null && !col.isTrigger)
// Find and set all colliders to trigger (we use OnTriggerEnter2D)
Collider2D[] colliders = GetComponentsInChildren<Collider2D>(true);
foreach (Collider2D col in colliders)
{
Debug.LogWarning("[PoopProjectile] Collider should be set as Trigger for target detection!");
if (!col.isTrigger)
{
col.isTrigger = true;
Debug.Log($"[PoopProjectile] Set collider '{col.name}' to trigger");
}
}
}
@@ -91,12 +100,10 @@ namespace Minigames.BirdPooper
/// <summary>
/// Trigger collision detection for targets (Phase 5).
/// TODO: Uncomment when Target.cs is implemented in Phase 5
/// Uses OnTriggerEnter2D with trigger collider.
/// </summary>
private void OnTriggerEnter2D(Collider2D other)
{
// Phase 5 integration - currently commented out
/*
if (other.CompareTag("Target"))
{
// Notify target it was hit
@@ -108,7 +115,6 @@ namespace Minigames.BirdPooper
Destroy(gameObject);
}
*/
}
}
}