Example #1
0
        private async Task OnFinish(SMHandoff smh, ICancellee prepared, CampaignSnapshot start_campaign,
                                    IBackgroundOrchestrator?bgo, IAyaPhotoBoard?photoBoard)
        {
            if (props.BgTransitionOut != null)
            {
                bgo?.QueueTransition(props.BgTransitionOut);
            }
            if (props.BossPhotoHP.Try(out _))
            {
                photoBoard?.TearDown();
            }
            //The shift-phase token is cancelled by timeout or by HP.
            var completedBy = prepared.Cancelled ?
                              (smh.Exec.isEnemy ?
                               (smh.Exec.Enemy.PhotoHP <= 0 && (props.photoHP ?? 0) > 0) ?
                               PhaseClearMethod.PHOTO :
                               (smh.Exec.Enemy.HP <= 0 && (props.hp ?? 0) > 0) ?
                               PhaseClearMethod.HP :
                               (PhaseClearMethod?)null :
                               null) ??
                              PhaseClearMethod.TIMEOUT :
                              PhaseClearMethod.CANCELLED;
            var pc = new PhaseCompletion(props, completedBy, smh.Exec, start_campaign, Timeout);

            if (pc.StandardCardFinish)
            {
                if (props.Boss != null)
                {
                    BulletManager.RequestPowerAura("powerup1", 0, 0, new RealizedPowerAuraOptions(
                                                       new PowerAuraOptions(new[] {
                        PowerAuraOption.Color(_ => ColorHelpers.CV4(props.Boss.colors.powerAuraColor)),
                        PowerAuraOption.Time(_ => 1f),
                        PowerAuraOption.Iterations(_ => - 1f),
                        PowerAuraOption.Scale(_ => 3.5f),
                        PowerAuraOption.Static(),
                        PowerAuraOption.High(),
                    }), GenCtx.Empty, smh.Exec.GlobalPosition(), smh.cT, null !));
                }
                smh.Exec.DropItems(pc.DropItems, 1.4f, 0.6f, 1f, 0.2f, 2f);
                DependencyInjection.MaybeFind <IRaiko>()
                ?.Shake(defaultShakeTime, defaultShakeMult, defaultShakeMag, smh.cT, null);
            }
            GameManagement.Instance.PhaseEnd(pc);
            if (pc.StandardCardFinish && !smh.Cancelled && props.Boss != null && pc.CaptureStars.HasValue)
            {
                Object.Instantiate(GameManagement.References.prefabReferences.phasePerformance)
                .GetComponent <PhasePerformance>().Initialize($"{props.Boss.CasualName} / Boss Card", pc);
                await WaitingUtils.WaitForUnchecked(smh.Exec, smh.cT, EndOfCardDelayTime, false);
            }
        }
Example #2
0
        private void UpdateVariant()
        {
            var v = variants[currVariant];

            sr.sprite = v.sprite;
            if (effect != null)
            {
                effect.InvokeCull();
            }
            if (time + timePerVariant < StopShiftingAfter)
            {
                effect = Instantiate(switchTell, tr).GetComponent <PowerAura>();
                var opts = new PowerAuraOptions(new[] {
                    PowerAuraOption.Color(ReflWrap <TP4> .Wrap(v.color)),
                    PowerAuraOption.Time(_ => timePerVariant),
                    PowerAuraOption.Iterations(_ => switchTellIterations),
                    PowerAuraOption.Scale(_ => switchTellScale),
                });
                effect.Initialize(new RealizedPowerAuraOptions(opts, GenCtx.Empty, Vector2.zero, Cancellable.Null, null !));
            }
            SFXService.Request(onSwitch);
        }