private void ProcMinors() { if (sound != null) { SFXService.Request(sound); } }
private void RequestEvent(EventType ev) { if (ev == EventType.SPEAKER_SFX) { SFXService.Request(currSpeaker?.SpeakSFX); } }
/// <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(); } }
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; }
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); }
/// <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(); }