private List <float> GetAllBookmarks()
        {
            List <float> allBookmarks = new List <float>(manualSplits);

            for (int i = 0; i < allBookmarks.Count; i++)
            {
                allBookmarks[i] = MathHelpers.SetDecimalPlaces(allBookmarks[i], decimalPrecision);
            }

            if (equalSplits > 1)
            {
                for (int i = 0; i < equalSplits; i++)
                {
                    float currentBookmark = MathHelpers.SetDecimalPlaces((float)i / (equalSplits - 1), decimalPrecision);
                    if (!allBookmarks.Contains(currentBookmark))
                    {
                        allBookmarks.Add(currentBookmark);
                    }
                }
            }

            allBookmarks.Sort();

            return(allBookmarks);
        }
Ejemplo n.º 2
0
        void Update()
        {
            if (slider == null)
            {
                slider = GetComponent <Slider>();
            }

            if (slider != null)
            {
                sliderErrored = false;
                slider.value  = MathHelpers.SetDecimalPlaces(slider.value, decimalPlaces);
            }
            else if (!sliderErrored)
            {
                Debug.LogError("SliderValueAdjuster(" + transform.name + "): Could not find slider component, this script should be attached to the same object that has the slider component");
                sliderErrored = true;
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Sets the x and y values' decimal places
 /// </summary>
 /// <param name="vector2">The original Vector2</param>
 /// <param name="places">Number of decimal places to keep</param>
 /// <returns>The vector with it's values' decimal places adjusted</returns>
 public static Vector2 SetDecimalPlaces(this Vector2 vector2, uint places)
 {
     return(new Vector2(MathHelpers.SetDecimalPlaces(vector2.x, places), MathHelpers.SetDecimalPlaces(vector2.y, places)));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Sets the x, y, and z values' decimal places
 /// </summary>
 /// <param name="vector3">The original Vector3</param>
 /// <param name="places">Number of decimal places to keep</param>
 /// <returns>The vector with it's values' decimal places adjusted</returns>
 public static Vector3 SetDecimalPlaces(this Vector3 vector3, uint places)
 {
     return(new Vector3(MathHelpers.SetDecimalPlaces(vector3.x, places), MathHelpers.SetDecimalPlaces(vector3.y, places), MathHelpers.SetDecimalPlaces(vector3.z, places)));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Sets the x, y, z, and w values' decimal places
 /// </summary>
 /// <param name="quaternion">The original quaternion rotation</param>
 /// <param name="places">Number of decimal places to keep</param>
 /// <returns>The quaternion with it's values' decimal places adjusted</returns>
 public static Quaternion SetDecimalPlaces(this Quaternion quaternion, uint places)
 {
     return(new Quaternion(MathHelpers.SetDecimalPlaces(quaternion.x, places), MathHelpers.SetDecimalPlaces(quaternion.y, places), MathHelpers.SetDecimalPlaces(quaternion.z, places), MathHelpers.SetDecimalPlaces(quaternion.w, places)));
 }