Exemplo n.º 1
0
 public float GetVolume(AudioEnum audioEnum)
 {
     auxContainer = GetLogicalComponent <ListAudioContainer>().GetContainer(audioEnum);
     audioMixer.GetFloat(auxContainer.Name, out volumeMixer);
     volumeMixer = MathfExtend.Percent(volumeMixer, rangeAudioDb);
     return(volumeMixer);
 }
Exemplo n.º 2
0
 public void DoSetVolume(AudioEnum audioEnum, float newVolume, bool isPercent)
 {
     if (isPercent)
     {
         newVolume = MathfExtend.ChangeRange(newVolume, rangeAudioDb);
     }
     auxContainer = GetLogicalComponent <ListAudioContainer>().ObeyGetContainer(audioEnum);
     audioMixer.SetFloat(auxContainer.Name, newVolume);
 }
Exemplo n.º 3
0
 public void SetSize(float percent)
 {
     if (rectTransform != null)
     {
         float   deltaFill    = MathfExtend.ChangeRange01(percent, Mathf.Abs(initWidth));
         Vector2 newOffsetMax = new Vector2(initWidth + deltaFill, rectTransform.offsetMax.y);
         rectTransform.offsetMax = newOffsetMax;
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Returns the volume during the transition
 /// </summary>
 public float ObeyReturnVolume()
 {
     auxVolume = Evalutate();
     if (decrease)
     {
         auxVolume = 1 - auxVolume;
     }
     return(MathfExtend.ChangeRange(auxVolume, lerpRange, volumeRange));
 }
Exemplo n.º 5
0
    public static Vector4 Lerp(Vector2 rangeX, Vector2 rangeY, Vector2 rangeZ, Vector2 rangeW, Vector4 t, FunctionEnum function = FunctionEnum.Linear)
    {
        Vector4 vector;

        vector.x = MathfExtend.Lerp(rangeX.x, rangeX.y, t.x, function);
        vector.y = MathfExtend.Lerp(rangeY.x, rangeY.y, t.y, function);
        vector.z = MathfExtend.Lerp(rangeZ.x, rangeZ.y, t.z, function);
        vector.w = MathfExtend.Lerp(rangeW.x, rangeW.y, t.w, function);
        return(vector);
    }
Exemplo n.º 6
0
 public float DoGetVolume(AudioEnum audioEnum, bool isPercent)
 {
     auxContainer = GetLogicalComponent <ListAudioContainer>().ObeyGetContainer(audioEnum);
     audioMixer.GetFloat(auxContainer.Name, out volumeMixer);
     if (isPercent)
     {
         volumeMixer = MathfExtend.Percent(volumeMixer, rangeAudioDb);
     }
     return(volumeMixer);
 }
Exemplo n.º 7
0
        private string ConvertInString(float newValue)
        {
            if (useRange)
            {
                newValue = MathfExtend.ChangeRange(newValue, rangeInput, rangeOutput);
                newValue = Mathf.FloorToInt(newValue);
            }

            return(newValue.ToString());
        }
Exemplo n.º 8
0
        public void SetVolume(AudioEnum audioEnum, float value, bool isPercent)
        {
            Debug.Assert(value >= 0 && value <= 1);

            if (isPercent)
            {
                value = MathfExtend.ChangeRange(value, rangeAudioDb);
            }
            auxContainer = GetLogicalComponent <ListAudioContainer>().GetContainer(audioEnum);
            audioMixer.SetFloat(auxContainer.Name, value);
        }
Exemplo n.º 9
0
 public override Vector2 GetForce()
 {
     if (curveX != null)
     {
         force.x = MathfExtend.ChangeRange(curveX.Evaluate(timer.TimeInPercent), rangeX);
     }
     if (curveY != null)
     {
         force.y = MathfExtend.ChangeRange(curveY.Evaluate(timer.TimeInPercent), rangeY);
     }
     return(force);
 }
Exemplo n.º 10
0
        public void DoSetVolume(AudioEnum audioEnum, float value, bool isPercent, float time, AnimationCurve curve = null)
        {
            if (isPercent)
            {
                value = MathfExtend.ChangeRange(value, rangeAudioDb);
            }
            auxContainer = GetLogicalComponent <ListAudioContainer>().ObeyGetContainer(audioEnum);
            audioMixer.GetFloat(auxContainer.Name, out volumeMixer);

            if (value != volumeMixer)
            {
                volumeMixer = auxContainer.ObeyReset(volumeMixer, value, time, curve);
                activeContainers.Add(auxContainer);
                isActivedContainer = true;
            }
        }
Exemplo n.º 11
0
        // Get the location of the path based on how far you have traveled
        public static bool GetPointByLength(this PearlSpline path, out Vector3 result, ref float length)
        {
            if (path == null)
            {
                result = default;
                return(false);
            }

            var totalLength = path.CalculateLength();

            length = MathfExtend.Clamp0(length, totalLength);
            float t = path.GetPercentByLength(length, totalLength);

            result = path.EvaluatePosition(t);

            return(t >= 1);
        }
Exemplo n.º 12
0
        // Get the percentage of the path based on how far you have traveled
        public static float GetPercentByLength(this PearlSpline path, float length, float totalLength = 0)
        {
            if (path == null)
            {
                return(0f);
            }

            if (totalLength == 0)
            {
                totalLength = path.CalculateLength();
            }

            if (totalLength == 0)
            {
                return(0);
            }

            length = MathfExtend.Clamp0(length, totalLength);
            return(length / totalLength);
        }
Exemplo n.º 13
0
        public void SetVolume(string nameGroup, float value, float time = 0, AnimationCurve curve = null)
        {
            Debug.Assert(value >= 0 && value <= 1 && time >= 0);

            value = MathfExtend.ChangeRange(value, rangeAudioDb);
            audioMixer.GetFloat(nameGroup, out volumeMixer);

            if (value != volumeMixer)
            {
                if (time != 0)
                {
                    volumeMixer = containers[nameGroup].Reset(volumeMixer, value, time, curve);
                    activeContainer.Add(containers[nameGroup]);
                }
                else
                {
                    volumeMixer = value;
                }
                audioMixer.SetFloat(nameGroup, volumeMixer);
            }
        }
Exemplo n.º 14
0
 public void OnChangeHealth(float actualHealth)
 {
     actualHealt = (int)MathfExtend.ChangeRange(actualHealth, maxHealth);
 }
Exemplo n.º 15
0
 private float GetVolume(string nameGroup)
 {
     audioMixer.GetFloat(nameGroup, out volumeMixer);
     volumeMixer = MathfExtend.Percent(volumeMixer, rangeAudioDb);
     return(volumeMixer);
 }
 private void Flip(Vector2 direction)
 {
     spriteRender.flipX = MathfExtend.Sign(direction.x) < 0;
 }
 private void AnimateMovement(Vector2 direction, bool isMovement)
 {
     animator.SetInteger("horizontal", MathfExtend.Sign(direction.x));
     animator.SetInteger("vertical", MathfExtend.Sign(direction.y));
     animator.SetBool("movement", isMovement);
 }
Exemplo n.º 18
0
 public override Vector2 GetForce()
 {
     force.x = MathfExtend.ChangeRange(timer.TimeInPercentReversed, rangeX);
     force.y = MathfExtend.ChangeRange(timer.TimeInPercentReversed, rangeY);
     return(force);
 }