Esempio n. 1
0
        public static BoundsInt ToBoundsInt(this Bounds b, MathfExtensions.RoundingMethod minRoundingMethod = MathfExtensions.RoundingMethod.RoundUpIfNotInteger, MathfExtensions.RoundingMethod maxRoundingMethod = MathfExtensions.RoundingMethod.RoundUpIfNotInteger)
        {
            BoundsInt output = new BoundsInt();

            output.SetMinMax(b.min.ToVec3Int(minRoundingMethod), b.max.ToVec3Int(maxRoundingMethod));
            return(output);
        }
Esempio n. 2
0
        public static Vector2Int ToVec2Int(this Vector3 v, MathfExtensions.RoundingMethod roundMethod = MathfExtensions.RoundingMethod.HalfOrLessRoundsDown)
        {
            switch (roundMethod)
            {
            case MathfExtensions.RoundingMethod.HalfOrLessRoundsDown:
                return(new Vector2Int(Mathf.RoundToInt(v.x), Mathf.RoundToInt(v.y)));

            default:
                throw new UnityException("The logic for handling the " + roundMethod.ToString() + " round method has not yet been implemented.");
            }
        }