Example #1
0
        public static void ControlPoolSM(Pred persist, BulletManager.StyleSelector styles, StateMachine sm, ICancellee cT, Pred condFunc)
        {
            BEHControl pc = new BEHControl(b => {
                if (condFunc(b.rBPI))
                {
                    var exec      = b.GetINode("f-pool-triggered", null);
                    using var gcx = b.rBPI.ctx.RevertToGCX(exec);
                    _             = exec.RunExternalSM(SMRunner.Cull(sm, cT, gcx));
                }
            }, persist, BulletManager.BulletControl.P_RUN, cT);

            for (int ii = 0; ii < styles.Complex.Length; ++ii)
            {
                GetPool(styles.Complex[ii]).AddPoolControlEOF(pc);
            }
        }
Example #2
0
        public override Task Start(SMHandoff smh)
        {
            var behs = BehaviorEntity.GetExecsForIDs(targets);

            if (behs.Length == 0)
            {
                Log.Unity($"Retarget operation with targets {string.Join(", ", targets)} found no BEH", level: Log.Level.WARNING);
                return(Task.CompletedTask);
            }
            else if (behs.Length == 1)
            {
                return(behs[0].RunExternalSM(SMRunner.Run(states[0], smh.cT, smh.GCX), false));
            }
            else
            {
                return(Task.WhenAll(behs.Select(x => x.RunExternalSM(SMRunner.Run(states[0], smh.cT, smh.GCX), false))));
            }
        }
Example #3
0
 public void WaitStep()
 {
     abh.WaitStep();
     looper.WaitStep();
     if (!looper.IsUnpaused)
     {
         wasPaused = true;
     }
     else
     {
         if (wasPaused && looper.props.unpause != null)
         {
             _ = looper.GCX.exec.RunExternalSM(SMRunner.Run(looper.props.unpause, abh.ch.cT, looper.GCX));
         }
         wasPaused = false;
         ++elapsedFrames;
     }
 }
Example #4
0
 public void Trigger(BehaviorEntity Exec, GenCtx gcx, ICancellee cT)
 {
     _ = Exec.GetINode("finish-triggered", null).RunExternalSM(SMRunner.Cull(this.states[0], cT, gcx));
 }
Example #5
0
        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();
        }