コード例 #1
0
        /// <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);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
        /// <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);
        }
コード例 #6
0
        /// <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();
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        /// <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;
        }
コード例 #9
0
        /// <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;
        }
コード例 #10
0
        /// <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);
            }
        }
コード例 #11
0
        /// <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);
            }
        }
コード例 #12
0
        /// <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);
            }
        }
コード例 #13
0
        /// <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;
        }
コード例 #14
0
 /// <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());
 }