123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System;
- using UnityEngine;
- namespace wf
- {
- public static class Math
- {
- public static int Round2(int num)
- {
- return Math.Min(Math.Max(num, 0), 99);
- }
- public static int Round3(int num)
- {
- return Math.Min(Math.Max(num, 0), 999);
- }
- public static int Round4(int num)
- {
- return Math.Min(Math.Max(num, 0), 9999);
- }
- public static int Round5(int num)
- {
- return Math.Min(Math.Max(num, 0), 99999);
- }
- public static long Round4(long num)
- {
- return Math.Min(Math.Max(num, 0L), 9999L);
- }
- public static long Round6(long num)
- {
- return Math.Min(Math.Max(num, 0L), 999999L);
- }
- public static int RoundMinMax(int num, int min, int max)
- {
- return Math.Min(Math.Max(num, min), max);
- }
- public static float RoundMinMax(float num, float min, float max)
- {
- return Math.Min(Math.Max(num, min), max);
- }
- public static long RoundMinMax(long num, long min, long max)
- {
- return Math.Min(Math.Max(num, min), max);
- }
- public static bool Approximately(Vector2 objA, Vector2 objB)
- {
- return Mathf.Approximately(objA.x, objB.x) && Mathf.Approximately(objA.y, objB.y);
- }
- public static bool Approximately(Vector3 objA, Vector3 objB)
- {
- return Mathf.Approximately(objA.x, objB.x) && Mathf.Approximately(objA.y, objB.y) && Mathf.Approximately(objA.z, objB.z);
- }
- }
- }
|