private void ProcMinors() { if (sound != null) { SFXService.Request(sound); } }
private void RequestEvent(EventType ev) { if (ev == EventType.SPEAKER_SFX) { SFXService.Request(currSpeaker?.SpeakSFX); } }
public static void LocalReset() { //AudioTrackService.ClearAllAudio(); SFXService.ClearConstructed(); Events.Event0.DestroyAll(); ETime.Slowdown.RevokeAll(MultiOp.Priority.CLEAR_SCENE); ETime.Timer.DestroyAll(); BehaviorEntity.DestroyAllSummons(); PublicDataHoisting.DestroyAll(); FiringCtx.ClearNames(); ReflWrap.ClearWrappers(); StateMachineManager.ClearCachedSMs(); BulletManager.ClearPoolControls(); BulletManager.ClearEmpty(); BulletManager.ClearAllBullets(); BulletManager.DestroyCopiedPools(); InstanceData.CampaignDataUpdated.Proc(); #if UNITY_EDITOR || ALLOW_RELOAD Events.LocalReset.Proc(); #endif //Ordered last so cancellations from HardCancel will occur under old data Instance = new InstanceData(InstanceMode.NULL); Debug.Log($"Reloading level: {Difficulty.Describe()} is the current difficulty"); UIManager.UpdateTags(); }
/// <summary> /// Create a sound effect. /// </summary> /// <param name="sfx">Sound effect</param> /// <param name="cond">Filter condition</param> /// <returns></returns> public static BehCFc SFX(string sfx, Pred cond) { return(new BehCFc(b => { if (cond(b.rBPI)) { SFXService.Request(sfx); } }, BM.BulletControl.P_RUN)); }
public void ShowMe() { if (UITop != null && !MenuActive) { MenuActive = true; SFXService.Request(openPauseSound); UITop.style.display = DisplayStyle.Flex; ResetCurrentNode(); Redraw(); } }
/// <summary> /// Sets a new SFX Service as the active one. /// </summary> /// <param name="pSFXService">SFX Service to register as currently active</param> public static void ProvideSFXService(SFXService pSFXService) { if (pSFXService != null) { _sfxService = pSFXService; } else { // If it is null, we provide a new SFX Service that does nothing _sfxService = new NullSFXService(); } }
public void HideMe(bool sfx = false) { if (UITop != null) { if (sfx) { SFXService.Request(closePauseSound); } UITop.style.display = DisplayStyle.None; MenuActive = false; } }
public override void RegularUpdate() { base.RegularUpdate(); if (player.AllowPlayerInput) { bool full = ChargeFull; charge = M.Clamp(chargeMin, chargeMax, charge + GetChargeRate(CameraState) * ETime.FRAME_TIME); if (!full && ChargeFull) { SFXService.Request(onFullCharge); } text.text = string.Format(textFormat, charge); text.color = TextColor; } //Log.Unity($"{CameraState} {charge} {PlayerInput.IsFiring}"); }
protected override void RegularUpdateMove() { orientationSwitchWaiting -= ETime.FRAME_TIME; if (player.IsTryingBomb && orientationSwitchWaiting < 0f) { orientationSwitchWaiting = orientationSwitchCooldown; CameraOrientation = Reverse(CameraOrientation); SFXService.Request(onOrientationSwitch); } //while firing, the angle is static and the position is controlled by the coroutine if (CameraState != State.FIRING) { angle = Mathf.Lerp(angle, BaseViewfinderAngle, lerpToAngleRate * ETime.FRAME_TIME); tr.position = location = Vector2.Lerp(location, TargetPosition, lerpToPositionRate * ETime.FRAME_TIME); viewfinder.eulerAngles = new Vector3(0f, 0f, angle + CameraOrientationAngleOffset); } }
private IEnumerator Run(Achievement acv) { lowerText.text = acv.Title; tr.localPosition = baseLoc + startOffset; Show(); SFXService.Request(sfx); yield return(tr.GoTo(baseLoc, inTime, InLerp)); for (float t = 0; t < waitTime; t += ETime.FRAME_TIME) { yield return(null); } yield return(tr.GoTo(baseLoc + endOffset, outTime, OutLerp)); Hide(); isRunning = false; }
public static void ClearForScene() { AudioTrackService.ClearAllAudio(false); SFXService.ClearConstructed(); BulletManager.ClearPoolControls(); Events.Event0.DestroyAll(); ETime.Slowdown.RevokeAll(MultiOp.Priority.CLEAR_SCENE); ETime.Timer.DestroyAll(); BulletManager.OrphanAll(); PublicDataHoisting.DestroyAll(); FiringCtx.ClearNames(); //SMs may have links to data hoisting, so we destroy both of them on phase end. ReflWrap.ClearWrappers(); StateMachineManager.ClearCachedSMs(); BehaviorEntity.ClearPointers(); AyaPhoto.ClearTextures(); }
private IEnumerator Tracker() { for (float t = 0; t < timeToMidSeq; t += ETime.FRAME_TIME) { yield return(null); } //SetColorA(upperText, 1); //SetColorA(lowerText, 1); for (float t = 0; t < timeFromMidToFirstHit; t += ETime.FRAME_TIME) { yield return(null); } SFXService.Request("x-metal"); for (float t = 0; t < timeFromFirstToSecondHit; t += ETime.FRAME_TIME) { yield return(null); } SFXService.Request("x-metal"); }
public void Show(Color?fillColor) { if (fillColor.Try(out var c)) { SFXService.Request(fillSound); filled.enabled = true; filled.color = c; var tr = filled.transform; tr.localScale = Vector3.zero; RunDroppableRIEnumerator(tr.ScaleTo(filledScale, scaleTime, scaler.Into <FXY>())); RunDroppableRIEnumerator(tr.RotateTo(new Vector3(0, 0, 360), rotTime, rotator.Into <FXY>())); } else { unfilled.enabled = true; var tr = unfilled.transform; tr.localScale = Vector3.zero; RunDroppableRIEnumerator(tr.ScaleTo(unfilledScale, scaleTime, M.EOutSine)); } }
private void Initialize(bool isNew, BehaviorEntity?parent, Movement movement, ParametricInfo pi, SOPlayerHitbox _target, float cold, float hot, BEHStyleMetadata style, ref RealizedLaserOptions options) { pi.ctx.laserController = ctr; ctr.SetYScale(options.yScale * defaultWidthMultiplier); //Needs to be done before Colorize sets first frame base.Initialize(style, options.AsBEH, parent, movement, pi, _target, out _); // Call after Awake/Reset if (options.endpoint != null) { var beh = BEHPooler.INode(Movement.None, new ParametricInfo(Vector2.zero, bpi.index), Vector2.right, options.endpoint); endpt = new PointContainer(beh); ctr.SetupEndpoint(endpt); } else { ctr.SetupEndpoint(new PointContainer(null)); } ctr.Initialize(this, config, style.RecolorOrThrow.material, isNew, bpi, ref options); SFXService.Request(options.firesfx); SetColdHot(cold, hot, options.hotsfx, options.repeat); ctr.Activate(); //This invokes UpdateMesh }
private IEnumerator LetsGo() { RunDroppableRIEnumerator(Velocity(upperText, MakeUpperVel)); RunDroppableRIEnumerator(Velocity(lowerText, MakeLowerVel)); RunDroppableRIEnumerator(Velocity(core, MakeCoreVel)); float t = 0; for (; t < 1.96f; t += ETime.FRAME_TIME) { yield return(null); } RunDroppableRIEnumerator( core.ScaleBy(2f, 0.34f, M.EOutSine)); for (; t < 1.98f; t += ETime.FRAME_TIME) { yield return(null); } RunDroppableRIEnumerator( core.RotateTo(new Vector3(0f, 0f, -10f), 3f, M.EOutSine)); SFXService.Request("x-metal"); }
private IEnumerator Timeout(float maxTime, bool withSound, float stayOnZero, ICancellee cT) { float currTime = maxTime; var currTimeIdent = -2; while (currTime > 0) { if (Mathf.RoundToInt(currTime * 10) != currTimeIdent) { timeout.text = string.Format(timeoutTextFormat, currTime); currTimeIdent = Mathf.RoundToInt(currTime * 10); } yield return(null); if (cT.Cancelled) { break; } var tryCross = Mathf.FloorToInt(currTime); currTime -= ETime.dT; if (withSound && currTime < tryCross) { if (0 < tryCross && tryCross <= countdownSounds.Length) { SFXService.Request(countdownSounds[tryCross - 1]); } } } if (currTime < 1) { timeout.text = string.Format(timeoutTextFormat, 0); } while (stayOnZero > 0f) { yield return(null); stayOnZero -= ETime.dT; } timeout.text = ""; }
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); }
private bool SetFrame(int f) { if (f < realizedFrames.Length) { currFrame = f; if (realizedFrames[f].collisionActive && !collisionActive && realizedFrames[f].time > 0f) { SFXService.Request(hotSfx); } collisionActive = realizedFrames[f].collisionActive; SetSprite(realizedFrames[f].s, realizedFrames[f].yscale); } else if (repeat) { SetFrame(0); } else { InvokeCull(); return(true); } return(false); }
public static Event BossExplode() => smh => { UnityEngine.Object.Instantiate(ResourceManager.GetSummonable("bossexplode")).GetComponent <ExplodeEffect>().Initialize(BossExplodeWait, smh.Exec.rBPI.loc); DependencyInjection.MaybeFind <IRaiko>()?.Shake(BossExplodeShake, ShakeMag, 2, smh.cT, null); SFXService.BossExplode(); return(WaitingUtils.WaitForUnchecked(smh.Exec, smh.cT, BossExplodeWait, false)); };
/// <summary> /// Make the player invulnerable for some number of frames. /// </summary> /// <param name="frames">Invulnerability frames (120 frames per second)</param> /// <returns></returns> public static Event PlayerInvuln(int frames) => smh => { PlayerHP.RequestPlayerInvulnerable.Publish((frames, true)); SFXService.Request("x-invuln"); return(Task.CompletedTask); };
public override void RegularUpdate() { if (!Application.isPlaying || !ETime.FirstUpdateForScreen) { return; } if (Current != null && MenuActive && !isTransitioning) { bool tried_change = true; bool allowsfx = true; var last = Current; int sentry = 0; do { var custom = Current.CustomEventHandling(); if (custom != null) { SFXService.Request(leftRightSound); //add another sound Current = custom; } else if (InputManager.UILeft.Active) { if (allowsfx) { SFXService.Request(leftRightSound); } Current = Current.Left(); } else if (InputManager.UIRight.Active) { if (allowsfx) { SFXService.Request(leftRightSound); } Current = Current.Right(); } else if (InputManager.UIUp.Active) { if (allowsfx) { SFXService.Request(upDownSound); } Current = Current.Up(); } else if (InputManager.UIDown.Active) { if (allowsfx) { SFXService.Request(upDownSound); } Current = Current.Down(); } else if (InputManager.UIConfirm.Active) { var(succ, nxt) = Current.Confirm_DontNest(); if (succ) { HandleTransition(Current, nxt, false); } if (allowsfx) { SFXService.Request(succ ? confirmSound : failureSound); } if (Current?.Passthrough == true) { Current = Current.Parent; } } else if (InputManager.UIBack.Active) { if (allowsfx) { SFXService.Request(backSound); } HandleTransition(Current, Current.Back(), true); } else { tried_change = false; } allowsfx = false; if (++sentry > 100) { throw new Exception("There is a loop in the XML menu."); } } while (Current?.Passthrough ?? false); if (tried_change) { OnChangeEffects(last); Redraw(); } } }
protected virtual void CollectMe() { SFXService.Request(onCollect); PooledDone(); }
private void PreparePhase(IUIManager?ui, SMHandoff smh, out Task cutins, IBackgroundOrchestrator?bgo, IAyaPhotoBoard?photoBoard) { cutins = Task.CompletedTask; ui?.ShowPhaseType(props.phaseType); if (props.cardTitle != null || props.phaseType != null) { var rate = (props.Boss != null) ? GameManagement.Instance.LookForSpellHistory(props.Boss.key, props.Index) : null; ui?.SetSpellname(props.cardTitle?.ToString(), rate); } if (!props.HideTimeout && smh.Exec.TriggersUITimeout) { ui?.ShowStaticTimeout(Timeout); } if (props.livesOverride.HasValue) { ui?.ShowBossLives(props.livesOverride.Value); } if (smh.Exec.isEnemy) { if (props.photoHP.Try(out var photoHP)) { smh.Exec.Enemy.SetPhotoHP(photoHP, photoHP); } else if ((props.hp ?? props.phaseType?.DefaultHP()).Try(out var hp)) { if (props.Boss != null) { hp = (int)(hp * GameManagement.Difficulty.bossHPMod); } smh.Exec.Enemy.SetHP(hp, hp); } if ((props.hpbar ?? props.phaseType?.HPBarLength()).Try(out var hpbar)) { smh.Exec.Enemy.SetHPBar(hpbar, props.phaseType ?? PhaseType.NONSPELL); } smh.Exec.Enemy.SetVulnerable(props.phaseType?.DefaultVulnerability() ?? (props.Boss == null ? Vulnerability.VULNERABLE : Vulnerability.NO_DAMAGE)); } if (props.BossPhotoHP.Try(out var pins)) { photoBoard?.SetupPins(pins); } bool forcedBG = false; if (GameManagement.Instance.mode != InstanceMode.CARD_PRACTICE && !SaveData.Settings.TeleportAtPhaseStart) { if (props.bossCutin && props.Boss != null && props.Background != null) { GameManagement.Instance.ExternalLenience(props.Boss.bossCutinTime); SFXService.BossCutin(); //Service not required since no callback DependencyInjection.MaybeFind <IRaiko>()?.Shake(props.Boss.bossCutinTime / 2f, null, 1f, smh.cT, null); Object.Instantiate(props.Boss.bossCutin); bgo?.QueueTransition(props.Boss.bossCutinTrIn); bgo?.ConstructTarget(props.Boss.bossCutinBg, true); WaitingUtils.WaitFor(smh, props.Boss.bossCutinBgTime, false).ContinueWithSync(() => { if (!smh.Cancelled) { bgo?.QueueTransition(props.Boss.bossCutinTrOut); bgo?.ConstructTarget(props.Background, true); } }); cutins = WaitingUtils.WaitForUnchecked(smh.Exec, smh.cT, props.Boss.bossCutinTime, false); forcedBG = true; } else if (props.GetSpellCutin(out var sc)) { SFXService.BossSpellCutin(); DependencyInjection.MaybeFind <IRaiko>()?.Shake(1.5f, null, 1f, smh.cT, null); Object.Instantiate(sc); } } if (!forcedBG && props.Background != null) { if (props.BgTransitionIn != null) { bgo?.QueueTransition(props.BgTransitionIn); } bgo?.ConstructTarget(props.Background, true); } }
/// <summary> /// Constructor provided the SFX Service to be wrapped. /// </summary> /// <param name="pWrappedService">SFX Service to wrap</param> public LoggedSFXService(SFXService pWrappedService) { _wrappedService = pWrappedService; }