using UnityEngine;
namespace Auralis
{
/// A separate painted annex beside the existing watch window and ladder.
public sealed class BellQuietEntrance:MonoBehaviour
{
public static BellQuietEntrance I;
public PocketRoom Room{get;private set;}
public SpriteRenderer Artwork{get;private set;}
public PortalCurtain Curtain{get;private set;}
public Vector2 Threshold=>BellWatchCourt.I.At(1272,576);
public static BellQuietEntrance Create(Transform parent)
{
var go=new GameObject("Glockenruhe · eigener Eingangsanbau");go.transform.SetParent(parent);
I=go.AddComponent();I.Build();return I;
}
void Build()
{
// Choose a free remote cell from the rooms actually constructed in this level.
int index=22;
while(PocketRoom.All.Exists(room=>Mathf.Abs(room.Center.x-(160+index*60))<30))index++;
Room=PocketRoom.Create(BellQuietTrial.RoomId,"Glockenruhe · freiwillige Prüfung",PocketRoomKind.Puzzle,Threshold,index,transform,paintedEntrance:true);
Artwork=ArtLibrary.Sprite("Eigener Kalkstein-/Kupferanbau mit offener Tür",ArtLibrary.Get("BellQuietEntrance"),Threshold,5,transform,false);
Artwork.transform.localScale=Vector3.one*Artwork.sprite.pixelsPerUnit*.00375f;
// Original 1254-square PNG, unmodified. Measured front threshold is (627,1148).
Artwork.transform.position+=(Vector3)Threshold-ArtLibrary.TexturePoint(Artwork,new Vector2(627f/1254,1148f/1254));
Curtain=PortalCurtain.InArch(Artwork,464,791,1148,543,430,1254,1254,9,transform);
}
void OnDestroy(){if(I==this)I=null;}
}
}