using UnityEngine;

/// <summary>
/// GAME 1303 Tier 3 — Marks a climbable area. Pair with LadderClimber on the player.
///
/// SETUP
///  - Ladder sprite (or tilemap piece) + BoxCollider2D (Is Trigger ON) covering the
///    full climbable height + this script. Make it a prefab.
///  - Top Platform (optional): if the ladder pokes through a one-way platform at the
///    top, drag that platform's Collider2D here so it gets ignored while climbing.
/// </summary>
[RequireComponent(typeof(Collider2D))]
public class Ladder : MonoBehaviour
{
    public Collider2D topPlatform;
    [Tooltip("Snap the player to the ladder's center X while climbing.")]
    public bool snapToCenter = true;

    public float CenterX => GetComponent<Collider2D>().bounds.center.x;
    public float TopY => GetComponent<Collider2D>().bounds.max.y;
    public float BottomY => GetComponent<Collider2D>().bounds.min.y;

    void Reset() { GetComponent<Collider2D>().isTrigger = true; }
}