using System.Collections.Generic; using UnityEngine; namespace Auralis { // A horizontal answer between the offered nest and the cathedral. The old // checkpoints and doorways remain the endpoints; the middle now has feet. public sealed class RiverForecourtPassage:MonoBehaviour { public static RiverForecourtPassage I; public readonly List Banks=new(); public BoxCollider2D CatchBank{get;private set;} public ClimbableLadder Recovery{get;private set;} public LittleFoeGroup Buds{get;private set;} public ArchivePatrol Ray{get;private set;} public RiverSeedSource Seed{get;private set;} public bool Here=>RiverWithoutBanksWorld.Area==4&&!DungeonRun.Inside&&!PocketRoom.Active; public bool Unsettled=>!RiverWithoutBanksWorld.Complete; public static Vector2 At(float x,float y)=>RiverWithoutBanksWorld.At(4,x,y); public string Guidance=>GameSession.I.Player.transform.position.y();I.owner=world;I.Build();return I; } void Build() { // An ordinary jump reaches every next support. No new power, forced // wait, scripted teleport or backwards errand stretches this route. Bank("Erster Wurzeltritt am linken Nest",547,320,92); Bank("Breite Nachtknospenbank",665,260,120); Bank("Hohe Tintenseglerbank",810,205,140); Bank("Rechter Wurzeltritt unter dem Windrochen",935,270,100); Bank("Letzte Wurzelstufe zum ursprünglichen Nest",1030,320,94); CatchBank=Bank("Durchgehender tiefer Wurzelsteg",757,600,490,false); var ladder=new GameObject("Rückleiter vom Fangsteg zum ersten Wurzeltritt");ladder.transform.SetParent(transform,false); Recovery=ladder.AddComponent();var foot=At(547,600);float head=At(547,320).y; Recovery.Init(foot.x,foot.y,head);Recovery.ExtendTo(head);owner.Ladders.Add(Recovery); RoomIntegratedPlatformArt.DressRiverRecovery(Recovery); owner.Winds.Find(w=>w&&w.Id=="river-cathedral-current")?.SetFlow(false); Buds=CampaignPopulation.SmallGroup(transform,"pop467-53-forecourt-buds",LittleFoeKind.DuskBud, At(630,260),At(700,260),2,true,available:()=>Here&&Unsettled); // Preserve the original ray's stable two-knot save identity. Ray=ArchivePatrol.Create(transform,"river-ray-forecourt",At(890,233),At(975,233),true); Ray.Available=()=>Here&&Unsettled;owner.Rays.Add(Ray); Seed=RiverSeedSource.Create(transform,At(737,590),At(737,220),"river-seed-rise-forecourt",()=>Here&&Unsettled&&!Ray.Released); CampaignPopulation.Hearts(transform,"pop467-53-forecourt-step-hearts",At(528,290),At(566,290),2,2); CampaignPopulation.Supply(transform,"pop467-53-forecourt-catch-feathers",At(580,575),SupplyKind.WindFeather,3); } BoxCollider2D Bank(string name,float x,float y,float width,bool route=true) { var bank=owner.AddBank(4,"forecourt-"+(route?Banks.Count.ToString():"catch"),x-width*.5f,x+width*.5f,y,transform); bank.gameObject.name=name;bank.gameObject.AddComponent(); if(route)Banks.Add(bank); RoomIntegratedPlatformArt.Dress(bank,"river-forecourt"); return bank; } public Vector2 IncomingBank(Vector2 feet,int direction) { Vector2 next=feet;float best=float.PositiveInfinity; foreach(var bank in Banks) { var b=bank.bounds;float dx=(b.center.x-feet.x)*direction; if(dx<.4f||dx>7.5f||b.max.y=best)continue;best=score;next=new Vector2(b.center.x,b.max.y); } return next; } void OnDestroy(){if(I==this)I=null;} } }