using UnityEngine;
namespace Auralis
{
/// An original compact courier annex on the existing crane-yard entry dock.
public sealed class ShipyardCourierEntrance:MonoBehaviour
{
public static ShipyardCourierEntrance I;
public PocketRoom Room{get;private set;}
public SpriteRenderer Artwork{get;private set;}
public PortalCurtain Curtain{get;private set;}
public Vector2 Threshold=>FerryCraneYard.I.At(325,538);
public static ShipyardCourierEntrance Create(Transform parent)
{
var go=new GameObject("Werftkurier · eigener Eingangsanbau");go.transform.SetParent(parent);
I=go.AddComponent();I.Build();return I;
}
void Build()
{
int index=22;
while(PocketRoom.All.Exists(room=>Mathf.Abs(room.Center.x-(160+index*60))<30))index++;
Room=PocketRoom.Create(ShipyardCourierTrial.RoomId,"Werftkurier · freiwillige Prüfung",PocketRoomKind.Puzzle,Threshold,index,transform,paintedEntrance:true);
Room.EntryRequirement=()=>GameSession.I.Save.Data.glide;
Room.EntryRequirementHint="Zum Werftkurier brauchst du die Fähigkeit Gleiten.";
// The existing crane return ladder is only 2.28 world units away. Keep both
// the prompt and Up/Interact doorway capture outside its own approach band.
Room.EntryPromptRadius=1.2f;Room.EntryTriggerRadius=Room.EntryInteractRadius=.95f;
Artwork=ArtLibrary.Sprite("Eigener Kurieranbau aus Eiche Stein und Kupfer",ArtLibrary.Get("ShipyardCourierEntrance"),Threshold,5,transform,false);
Artwork.transform.localScale=Vector3.one*Artwork.sprite.pixelsPerUnit*.0046f;
// Unaltered 1254-square PNG. The front threshold is measured at (625,1090).
Artwork.transform.position+=(Vector3)Threshold-ArtLibrary.TexturePoint(Artwork,new Vector2(625f/1254,1090f/1254));
Curtain=PortalCurtain.InArch(Artwork,450,800,1090,620,540,1254,1254,9,transform,()=>GameSession.I.Save.Data.glide);
}
void OnDestroy(){if(I==this)I=null;}
}
}