private IEnumerator RunTutorial(Action cb) { IEnumerator wait(Func <bool> cond) { while (!cond()) { yield return(null); } } IEnumerator confirm() { yield return(null); yield return(wait(() => UIConfirm.Active && !EngineStateManager.IsPaused)); } DependencyInjection.Find <IUIManager>() .SetSpellname("Reduced Tutorial (For Players Too Smart for the Normal Tutorial)"); var mov = new Movement(new Vector2(-2, 2.5f), 0); BulletManager.RequestSimple("lcircle-red/", _ => 4f, null, mov, new ParametricInfo(in mov)); var nrx = new RealizedLaserOptions(new LaserOptions(), GenCtx.New(this, V2RV2.Zero), FiringCtx.New(), new Vector2(3, 5), V2RV2.Angle(-90), Cancellable.Null); "sync _ <> relrect greenrect level <-2;2.5:1.4;1.4:0> witha 0.7 green".Into <StateMachine>() .Start(new SMHandoff(this, Cancellable.Null)); Message(text10, mtcirc1(UIConfirm.Desc)); yield return(confirm()); BulletManager.ClearAllBullets(); BehaviorEntity.GetExecForID("greenrect").InvokeCull(); mov = new Movement(new Vector2(-3, 5), -90); BulletManager.RequestLaser(null, "mulaser-blue/b", mov, new ParametricInfo(in mov), 999, 0, ref nrx); mov = new Movement(new Vector2(-2, 5), -90); BulletManager.RequestLaser(null, "zonelaser-green/b", mov, new ParametricInfo(in mov), 999, 0, ref nrx); Message(text10, mtsafe2(UIConfirm.Desc)); yield return(confirm()); cb(); }
private IEnumerator RunTutorial(int skips) { while (SceneIntermediary.LOADING) { yield return(null); } bool canSkip() => skips-- > 0; IEnumerator wait(Func <bool> cond) { if (!canSkip()) { while (!cond()) { yield return(null); } } } IEnumerator waitlf(Func <bool> cond) => wait(() => ETime.FirstUpdateForScreen && cond()); IEnumerator waiti(IInputHandler ih) { yield return(null); yield return(waitlf(() => ih.Active)); } IEnumerator waitir(IInputHandler ih) { yield return(null); yield return(waitlf(() => !ih.Active)); } IEnumerator confirm() => waiti(UIConfirm); DependencyInjection.Find <IUIManager>().SetSpellname("Tutorial"); Message(text10, welcome1(UIConfirm.Desc)); yield return(confirm()); Prompt(text10, blue2(Pause.Desc)); yield return(waitlf(() => EngineStateManager.IsPaused)); UIManager.PauseMenu !.GoToOption(0); const float menuLeft = -4.8f; Message(text00, pause3, x: menuLeft); yield return(confirm()); Message(text00, shaders4, x: menuLeft); yield return(confirm()); Prompt(text00, shaders5, 1.2f, x: menuLeft); var sd = SaveData.s.Shaders; yield return(waitlf(() => SaveData.s.Shaders != sd)); Prompt(text00, res6, 0.85f, x: menuLeft); var r = SaveData.s.Resolution; yield return(waitlf(() => SaveData.s.Resolution != r)); Message(text00, refresh7, 0.5f, x: menuLeft); yield return(confirm()); Message(text00, fullscreen8, 0.15f, x: menuLeft); yield return(confirm()); Message(text00, vsync9, -0.25f, x: menuLeft); yield return(confirm()); Message(text00, inputsmooth10, -0.7f, x: menuLeft); yield return(confirm()); Prompt(text00, unpause11(Pause.Desc), x: menuLeft); yield return(waitlf(() => !EngineStateManager.IsLoadingOrPaused)); var mov = new Movement(new Vector2(-2, 2.5f), 0); BulletManager.RequestSimple("lcircle-red/", _ => 4f, null, mov, new ParametricInfo(in mov)); var nrx = new RealizedLaserOptions(new LaserOptions(), GenCtx.New(this, V2RV2.Zero), FiringCtx.New(), new Vector2(3, 5), V2RV2.Angle(-90), Cancellable.Null); mov = new Movement(new Vector2(2, 5), -90); BulletManager.RequestLaser(null, "mulaser-blue/b", mov, new ParametricInfo(in mov), 999, 0, ref nrx); mov = new Movement(new Vector2(3, 5), -90); BulletManager.RequestLaser(null, "zonelaser-green/b", mov, new ParametricInfo(in mov), 999, 0, ref nrx); "sync _ <> relrect greenrect level <-2;2.5:1.4;1.4:0> witha 0.7 green".Into <StateMachine>() .Start(new SMHandoff(this)); Message(text10, redcircle12); yield return(confirm()); Message(text10, legacy13); yield return(confirm()); Message(text10, safelaser14); yield return(confirm()); BulletManager.ClearAllBullets(); BehaviorEntity.GetExecForID("greenrect").InvokeCull(); Prompt(text10, fire15(ShootHold.Desc)); yield return(waitir(ShootHold)); yield return(waiti(ShootHold)); Prompt(text10, move16); yield return(waitlf(() => Math.Abs(HorizontalSpeed01) > 0.1 || Math.Abs(VerticalSpeed01) > 0.1)); Prompt(text10, focus17(FocusHold.Desc)); yield return(waiti(FocusHold)); var bcs = new Cancellable(); var boss = GameObject.Instantiate(tutorialBoss).GetComponent <BehaviorEntity>(); boss.Initialize(SMRunner.CullRoot(StateMachine.CreateFromDump(bossSM.text), bcs)); IEnumerator phase() { while (boss.PhaseShifter == null) { yield return(null); } var pct = boss.PhaseShifter; if (canSkip()) { boss.ShiftPhase(); } else { yield return(wait(() => pct.Cancelled)); } for (int ii = 0; ii < 244; ++ii) { yield return(null); //phase delay if (EngineStateManager.IsRunning) { ++ii; } } } IEnumerator shift() { boss.ShiftPhase(); for (int ii = 0; ii < 4; ++ii) { yield return(null); //phase delay } } for (int ii = 0; ii < 8; ++ii) { yield return(null); //start delay } Message(text10, boss18); yield return(confirm()); Message(text10, hpbar19); yield return(confirm()); yield return(shift()); Prompt(text10, ns20); yield return(phase()); Prompt(text10, nss21); yield return(phase()); Prompt(text10, spell22); yield return(phase()); Prompt(text10, survival23); yield return(phase()); Message(text10, items24); yield return(confirm()); Message(text10, bullets25); yield return(confirm()); yield return(shift()); Prompt(text10, shoot26); yield return(phase()); Message(text10, lives27, 0.3f); yield return(confirm()); Instance.SetLives(10); Message(text10, dots28); yield return(confirm()); Instance.SetLives(15); Message(text10, dots29); yield return(confirm()); Instance.SetLives(1); Message(text10, dots30); yield return(confirm()); Message(text10, nobombs31); yield return(confirm()); yield return(shift()); Prompt(text10, pleasedie32); yield return(waitlf(() => EngineStateManager.IsDeath)); Prompt(text00, deathscreen33, x: menuLeft); yield return(waitlf(() => !EngineStateManager.IsDeath)); yield return(shift()); Message(text10, lifeitems34, -0.3f); yield return(confirm()); yield return(shift()); Prompt(text10, lifeitems35); int currLives = Instance.Lives; yield return(waitlf(() => Instance.Lives > currLives)); yield return(shift()); Message(text10, valueitems36(InstanceData.valueItemPoints)); yield return(confirm()); yield return(shift()); Prompt(text10, points37); yield return(waitlf(() => Instance.Score > 75000)); yield return(shift()); Message(text00, scoremult38); yield return(confirm()); Message(text00, faith39(InstanceData.pivFallStep)); yield return(confirm()); Message(text00, faithblue40); yield return(confirm()); Message(text10, graze41); yield return(confirm()); yield return(shift()); Prompt(text10, scoremult42); yield return(waitlf(() => Instance.PIV >= 1.11)); yield return(shift()); yield return(waitlf(() => Instance.PIV <= 1.0)); Message(text10, scoreext43); yield return(confirm()); yield return(shift()); Prompt(text10, scoreext44); yield return(waitlf(() => Instance.Score > 2000000)); yield return(shift()); Message(text10, ability45); yield return(confirm()); yield return(shift()); Prompt(text10, ability46(Meter.Desc)); GameManagement.Instance.AddGems(100); yield return(waitlf(() => InputManager.IsMeter)); yield return(shift()); Message(text10, ability47); yield return(confirm()); Message(text10, meter48); yield return(confirm()); yield return(shift()); Message(text10, hitbox49); yield return(confirm()); yield return(shift()); Message(text10, hitbox50); yield return(confirm()); yield return(shift()); Message(text10, safelaser51); yield return(confirm()); yield return(shift()); Prompt(text10, end52); SaveData.r.CompleteTutorial(); }