/// <summary> /// Computes the new value of the count for the current time /// </summary> /// <param name="currentValue"></param> /// <returns></returns> protected virtual float ProcessCount() { float currentTime = FeedbackTime - _startTime; float currentValue = MMTween.Tween(currentTime, 0f, Duration, CountFrom, CountTo, CountingCurve); return(currentValue); }
public override void ShowPrompt() { if (_promptHiddenForever) { return; } PromptContainer.gameObject.SetActive(true); MMTween.TweenScale(this, PromptContainer.transform, Vector3.zero, Vector3.one, null, 0f, FadeDuration, MMTween.MMTweenCurve.EaseOutElastic); }
protected virtual void SetValue(float time) { float intensity = MMTween.Tween(time, 0f, 1f, RemapZero, RemapOne, SoftnessCurve); float newValue = intensity; if (RelativeValues) { newValue += _initialSoftness; } TargetTMPText.fontMaterial.SetFloat(ShaderUtilities.ID_OutlineSoftness, newValue); }
/// <summary> /// Sets the various values on the target property on a specified time (between 0 and 1) /// </summary> /// <param name="time"></param> protected virtual void SetValues(float time) { float intensity = MMTween.Tween(time, 0f, 1f, RemapLevelZero, RemapLevelOne, LevelCurve); if (RelativeValues) { intensity += _initialIntensity; } Target.SetLevel(intensity); }
/// <summary> /// Tweens the object from origin to destination /// </summary> /// <param name="collider"></param> /// <param name="origin"></param> /// <param name="destination"></param> /// <returns></returns> protected virtual IEnumerator TeleportTweenCo(Collider2D collider, Vector3 origin, Vector3 destination) { float startedAt = Time.unscaledTime; while (Time.unscaledTime - startedAt < DelayBetweenFades / 2f) { float elapsedTime = Time.unscaledTime - startedAt; collider.transform.position = MMTween.Tween(elapsedTime, 0f, DelayBetweenFades / 2f, origin, destination, TweenCurve); yield return(null); } _ignoreList.Remove(collider.transform); }
/// <summary> /// Sets the Dilate value /// </summary> /// <param name="time"></param> protected virtual void SetValue(float time) { float intensity = MMTween.Tween(time, 0f, 1f, RemapZero, RemapOne, DilateCurve); float newValue = intensity; if (RelativeValues) { newValue += _initialDilate; } TargetTMPText.fontMaterial.SetFloat(ShaderUtilities.ID_FaceDilate, newValue); TargetTMPText.UpdateMeshPadding(); }
protected virtual IEnumerator DisplayMessageCo() { yield return(_initialWaitForSeconds); Container.SetActive(true); MMTween.TweenScale(this, this.transform, Vector3.zero, Vector3.one, null, 0f, TransitionDuration, MMTween.MMTweenCurve.EaseOutOverhead); yield return(_displayWaitForSeconds); MMTween.TweenScale(this, this.transform, Vector3.one, Vector3.zero, null, 0f, TransitionDuration, MMTween.MMTweenCurve.EaseInQuadratic); yield return(_transitionWaitForSeconds); Container.SetActive(false); }
/// <summary> /// Applies the alpha change /// </summary> /// <param name="time"></param> protected virtual void SetAlpha(float time) { float newAlpha = 0f; if (AlphaMode == AlphaModes.Interpolate) { newAlpha = MMTween.Tween(time, 0f, 1f, CurveRemapZero, CurveRemapOne, Curve); } else if (AlphaMode == AlphaModes.ToDestination) { newAlpha = MMTween.Tween(time, 0f, 1f, _initialAlpha, DestinationAlpha, Curve); } TargetTMPText.alpha = newAlpha; }
/// <summary> /// Sets the various values on the sprite renderer on a specified time (between 0 and 1) /// </summary> /// <param name="time"></param> protected virtual void SetAlpha(float time) { float newAlpha = 0f; if (Mode == Modes.OverTime) { newAlpha = MMTween.Tween(time, 0f, 1f, CurveRemapZero, CurveRemapOne, Curve); } else if (Mode == Modes.ToDestination) { newAlpha = MMTween.Tween(time, 0f, 1f, _initialAlpha, DestinationAlpha, Curve); } _imageColor.a = newAlpha; BoundImage.color = _imageColor; }
/// <summary> /// Sets the various values on the target property on a specified time (between 0 and 1) /// </summary> /// <param name="time"></param> protected virtual void SetValues(float time) { if (_targets.Count == 0) { return; } foreach (MMFeedbackBaseTarget target in _targets) { float intensity = MMTween.Tween(time, 0f, 1f, target.RemapLevelZero, target.RemapLevelOne, target.LevelCurve); if (RelativeValues) { intensity += target.InitialLevel; } target.Target.SetLevel(intensity); } }
/// <summary> /// Sets the various values on the target property on a specified time (between 0 and 1) /// </summary> /// <param name="time"></param> protected virtual void SetValues(float time, float feedbacksIntensity) { if (_targets.Count == 0) { return; } float intensityMultiplier = Timing.ConstantIntensity ? 1f : feedbacksIntensity; foreach (MMFeedbackBaseTarget target in _targets) { float intensity = MMTween.Tween(time, 0f, 1f, target.RemapLevelZero, target.RemapLevelOne, target.LevelCurve); if (RelativeValues) { intensity += target.InitialLevel; } target.Target.SetLevel(intensity * intensityMultiplier); } }
/// <summary> /// Sets the various values on the fog on a specified time (between 0 and 1) /// </summary> /// <param name="time"></param> protected virtual void SetFogValues(float time) { if (ModifyColor) { RenderSettings.fogColor = ColorOverTime.Evaluate(time); } if (ModifyFogDensity) { RenderSettings.fogDensity = MMTween.Tween(time, 0f, 1f, DensityRemapZero, DensityRemapOne, DensityCurve); } if (ModifyStartDistance) { RenderSettings.fogStartDistance = MMTween.Tween(time, 0f, 1f, StartDistanceRemapZero, StartDistanceRemapOne, StartDistanceCurve); } if (ModifyEndDistance) { RenderSettings.fogEndDistance = MMTween.Tween(time, 0f, 1f, EndDistanceRemapZero, EndDistanceRemapOne, EndDistanceCurve); } }
/// <summary> /// A coroutine used to move to each stored target to attack them /// </summary> /// <returns></returns> protected virtual IEnumerator AttackCoroutine() { float intervalDuration = AttackDuration / _targets.Count; // we play our initial attack feedback AttackFeedback?.PlayFeedbacks(); int enemyCounter = 0; foreach (Vector3 destination in _targets) { // for each new enemy, we play an attack feedback IndividualAttackFeedback?.PlayFeedbacks(); MMTween.MoveTransform(this, this.transform, this.transform.position, destination, null, 0f, intervalDuration, AttackCurve); _lookAtTarget = destination; yield return(MMCoroutine.WaitFor(intervalDuration - enemyCounter * IntervalDecrement)); enemyCounter++; } MMTween.MoveTransform(this, this.transform, this.transform.position, _initialPosition, null, 0f, intervalDuration, AttackCurve); _lookAtTarget = _initialLookAtTarget; }
/// <summary> /// Hides the button A prompt. /// </summary> public override void HidePrompt() { MMTween.TweenScale(this, PromptContainer.transform, Vector3.one, Vector3.zero, null, 0f, FadeDuration, MMTween.MMTweenCurve.EaseOutQuartic); StartCoroutine(HidePromptCo()); }