using System.Collections.Generic; using UnityEngine; namespace Auralis { // A continuous, built ascent above the existing stair. Falling rejoins its // last safe landing; rooms, optional memories and earned receipts remain. public sealed class StarArchiveAscent:MonoBehaviour { public const string CompleteKey="star-ascent-crossed"; public static StarArchiveAscent I; public LevelDoor Exit{get;private set;} public MovingLift Carrier{get;private set;} public BoxCollider2D SummitBank{get;private set;} public readonly List Banks=new(); public readonly List Fragile=new(); public LittleFoeGroup FirstWatch{get;private set;} public LittleFoeGroup UpperWatch{get;private set;} public ArchiveWindField FirstWind{get;private set;} public ArchiveWindField LastWind{get;private set;} public Vector2 Entry=>StarArchiveWorld.At(3,1350,286); public Vector2 Summit=>P(185.8f,31.2f); public static Vector2 Offset=>StarArchiveWorld.RoomOffset(3); static Vector2 P(float x,float y)=>new Vector2(x,y)+Offset; public bool Complete=>GameSession.I&&GameSession.I.Save.Data.mechanisms.Contains(CompleteKey); public bool Clear=>FirstWatch&&UpperWatch&&FirstWatch.Cleared&&UpperWatch.Cleared; public bool Inside=>StarArchiveWorld.Area==3&&GameSession.I.Player.transform.position.y>10.05f+Offset.y; public string Guidance { get { float y=GameSession.I.Player.transform.position.y-Offset.y; string next=y<13.3f?"Versetzte Steinbanken · links zur Winddüse":!FirstWatch.Cleared? "Tintensegler bindet die Düse · ein Pfeil löst den Wind":y<17.8f? "In die helle Spirale springen · halten und oben links aussteigen":y<20.15f? "Fahrende Steinbank · am rechten Halt zur hohen Bank springen":y<25.2f? "Rissige Tritte geben nach · zügig zur festen linken Bank":!UpperWatch.Cleared? "Zwei Tintensegler nacheinander · auf der festen Bank schießen": "Letzte Spirale · oben rechts durch den Sternenbogen"; return "DER HOHE STERNENWEG\n"+next; } } readonly List sprites=new(); Sprite middle,leftCap,rightCap;StarArchiveWorld owner;bool firstAnswered,lastAnswered; public static StarArchiveAscent Create(StarArchiveWorld world) { var o=new GameObject("4-1 · fortlaufender hoher Sternenweg");o.transform.SetParent(world.RoomRoot(3)); I=o.AddComponent();I.owner=world;I.Build();return I; } void Build() { var kit=Resources.Load("GameArt/LateStarArchitectureV1"); middle=Cut(kit,new Rect(104,1024-232,176,136),new Vector2(.5f,1)); leftCap=Cut(kit,new Rect(24,1024-232,80,136),new Vector2(.5f,1)); rightCap=Cut(kit,new Rect(1428,1024-232,82,136),new Vector2(.5f,1)); Bank("Erster versetzter Tritt",184.4f,11.65f,4.0f); Bank("Breite erste Kampfbank",179.2f,13.5f,5.0f); Bank("Fangbank unter der ersten Spirale",176.5f,12.65f,15.2f); Recovery("Feste Rückleiter zur ersten Kampfbank",180.2f,12.65f,13.5f); FirstWatch=CampaignPopulation.SmallGroup(transform,"pop46-41-ascent-first",LittleFoeKind.InkSailor, P(178.2f,13.5f),P(181.0f,13.5f),1,false,.85f,()=>StarArchiveWorld.Area==3); FirstWind=ArchiveWindField.Create(transform,"star-ascent-first-wind",new Rect(175.9f+Offset.x,13.5f+Offset.y,2.1f,5.8f),speed:4.8f,room:3); Bank("Linker Ausstieg aus dem ersten Aufwind",174.6f,18.0f,4.4f); var moving=Bank("Fahrende Sternenbank mit zwei Halten",180.0f,18.15f,3.4f); Carrier=moving.gameObject.AddComponent();Carrier.Amplitude=.14f;Carrier.HorizontalTravel=4.6f;Carrier.CycleSeconds=10; Bank("Feste Bank vor den rissigen Tritten",185.8f,20.25f,4.6f); Fragile.Add(CrumblingPlatform.Attach(Bank("Erster sichtbar rissiger Tritt",181.2f,21.95f,3.3f),1.25f,3.6f)); Fragile.Add(CrumblingPlatform.Attach(Bank("Zweiter rissiger Tritt",176.8f,23.65f,3.3f),1.25f,3.6f)); Bank("Breite Ruhebank nach den kurzen Tritten",172.7f,25.35f,4.4f); Bank("Feste obere Kampfbank",178.0f,27.0f,5.0f); // The recovery floor cannot jump straight to the high exit bank. // Its fixed ladder rejoins the beginning of the moving crossing. Bank("Fangweg unter Fahrt und kurzen Tritten",179.5f,17.05f,19.0f); Recovery("Rückleiter zum linken Fahrhalt",173.2f,17.05f,18.0f); UpperWatch=CampaignPopulation.SmallGroup(transform,"pop46-41-ascent-upper",LittleFoeKind.InkSailor, P(176.2f,27),P(179.3f,27),2,true,.85f,()=>StarArchiveWorld.Area==3); LastWind=ArchiveWindField.Create(transform,"star-ascent-last-wind",new Rect(179.7f+Offset.x,27+Offset.y,2.0f,5.4f),speed:4.8f,room:3); // Bank takes room-local coordinates and applies the room offset. // Summit is already world-space; applying that offset twice left // the visible portal without any landing after the spatial move. SummitBank=Bank("Getragener Sternenbogen am Gipfel",185.8f,31.2f,6.2f); var archSprite=Cut(kit,new Rect(328,1024-944,428,484),new Vector2(.5f,0)); var arch=ArtLibrary.Sprite("Eigener Steinbogen am oberen Ziel",archSprite,Vector2.zero,5,transform); ArtLibrary.Height(arch,4.0f);arch.transform.position+=(Vector3)Summit-ArtLibrary.TexturePoint(arch,new Vector2(548f/1536,914f/1024)); PortalCurtain.InArch(arch,441,655,914,638,521,1536,1024,8,transform,()=>Clear||Complete); Exit=LevelDoor.Create(Summit,transform,"Durch den Sternenbogen zur Archivvorhalle",()=>Clear||Complete,Finish); CampaignPopulation.Hearts(transform,"pop46-41-ascent-first-release",P(178.0f,14.1f),P(180.2f,14.1f),3,2,()=>FirstWatch.Cleared); CampaignPopulation.Hearts(transform,"pop46-41-ascent-crossing",P(184.8f,20.85f),P(186.8f,20.85f),3,2); CampaignPopulation.Supply(transform,"pop46-41-ascent-rest",P(172.1f,25.95f),SupplyKind.WindFeather,4); CampaignPopulation.Hearts(transform,"pop46-41-ascent-upper-release",P(177,27.6f),P(179,27.6f),3,2,()=>UpperWatch.Cleared); QuestBeacon.Create(transform,FirstWind.Source+Vector2.up*.55f,.36f,ArtLibrary.Gold,()=>StarArchiveWorld.Area==3&&!FirstWatch.Cleared); QuestBeacon.Create(transform,Summit+Vector2.up*1.5f,.45f,ArtLibrary.Teal,()=>StarArchiveWorld.Area==3&&(Clear||Complete)); RainFlow.Lamp("Kühles Sternenlicht an der hohen Ruhebank",P(172.7f,26.0f),4.1f,new Color(.62f,.74f,1),.17f,transform); RainFlow.Lamp("Warmes Messinglicht am oberen Bogen",Summit+Vector2.up*2.1f,4.6f,ArtLibrary.Gold,.19f,transform); FirstWind.SetFlow(FirstWatch.Cleared);LastWind.SetFlow(UpperWatch.Cleared); firstAnswered=FirstWatch.Cleared;lastAnswered=UpperWatch.Cleared; } Sprite Cut(Texture2D texture,Rect rect,Vector2 pivot) {var s=Sprite.Create(texture,rect,pivot,100,0,SpriteMeshType.FullRect);sprites.Add(s);return s;} BoxCollider2D Bank(string title,float x,float y,float width) { var o=new GameObject(title);o.transform.SetParent(transform);o.transform.position=P(x,y);o.layer=6; var c=o.AddComponent();c.size=new Vector2(width,.18f);c.offset=Vector2.down*.09f; o.AddComponent(); o.AddComponent();o.AddComponent().Material=GroundMaterial.Stone;Banks.Add(c); RoomIntegratedPlatformArt.Dress(c,"star-high-path",title.StartsWith("Fahr",System.StringComparison.Ordinal)); return c; } void Recovery(string title,float x,float bottom,float top) { var o=new GameObject(title);o.transform.SetParent(transform);var l=o.AddComponent(); l.Init(x+Offset.x,bottom+Offset.y,top+Offset.y);l.ExtendTo(top+Offset.y);owner.Ladders.Add(l); } void Update() { var g=GameSession.I;if(!g||!g.Playing)return; FirstWind.SetFlow(FirstWatch.Cleared);LastWind.SetFlow(UpperWatch.Cleared); if(!firstAnswered&&FirstWatch.Cleared){firstAnswered=true;Answer(FirstWind.Source,"Der erste Tintensegler ist frei. Die linke Winddüse trägt dich weiter.");} if(!lastAnswered&&UpperWatch.Cleared){lastAnswered=true;Answer(LastWind.Source,"Die obere Bank ist frei. Folge der letzten Spirale rechts zum Sternenbogen.");} } void Answer(Vector2 at,string words) {AudioDirector.I.Play("StarGlass",at,.36f);WorldEffects.I.Burst(at+Vector2.up*.25f,ArtLibrary.Teal,12,.9f);if(StarArchiveWorld.Area==3)GameSession.I.Hud.Toast(words,4);} void Finish() { var g=GameSession.I;if(!Clear&&!Complete)return; if(!Complete){g.Save.Data.mechanisms.Add(CompleteKey);g.Save.Write();} owner.Enter(4,259,808); } public static Vector3 CameraPoint(Vector3 p) { // Real height and horizontal progress remain visible across the // whole climb rather than being squeezed into one room-sized view. return new Vector3(Mathf.Clamp(p.x,176.0f+Offset.x,183.0f+Offset.x),Mathf.Clamp(p.y+2.6f,12.0f+Offset.y,33.3f+Offset.y),-20); } void OnDestroy(){if(I==this)I=null;foreach(var s in sprites)if(s)Destroy(s);} } }