private void Awake() { AudioTrackService.InvokeBGM(bgm); }
public override async Task Start(SMHandoff smh) { var jsmh = smh.CreateJointCancellee(out var cts); var subbosses = new List <Enemy>(); var subsummons = new List <BehaviorEntity>(); var ui = DependencyInjection.MaybeFind <IUIManager>(); if (props.boss != null) { GameManagement.Instance.SetCurrentBoss(props.boss, jsmh.Exec, jsmh.cT); ui?.SetBossHPLoader(jsmh.Exec.Enemy); (subbosses, subsummons) = ConfigureAllBosses(ui, jsmh, props.boss, props.bosses); } bool firstBoss = true; for (var next = jsmh.Exec.phaseController.WhatIsNextPhase(); next > -1 && next < phases.Length; next = jsmh.Exec.phaseController.WhatIsNextPhase(next + 1)) { if (phases[next].props.skip) { continue; } if (PHASE_BUFFER) { await WaitingUtils.WaitForUnchecked(jsmh.Exec, jsmh.cT, ETime.FRAME_TIME * 2f, false); } jsmh.ThrowIfCancelled(); if (props.bgms != null) { AudioTrackService.InvokeBGM(props.bgms.GetBounded(next, null)); } if (props.boss != null && next >= props.setUIFrom) { SetUniqueBossUI(ui, firstBoss, jsmh, props.bosses == null ? props.boss : props.bosses[props.bossUI?.GetBounded(next, 0) ?? 0]); firstBoss = false; } //don't show lives on setup phase if (next > 0 && props.boss != null) { ui?.ShowBossLives(RemainingLives(next)); } try { await phases[next].Start(jsmh, ui, subbosses); } catch (OperationCanceledException) { //Runs the cleanup code if we were cancelled break; } } cts.Cancel(); if (props.boss != null && !SceneIntermediary.LOADING) { ui?.CloseBoss(); if (!firstBoss) { ui?.CloseProfile(); } foreach (var subsummon in subsummons) { subsummon.InvokeCull(); } } }