1234567891011121314151617181920212223242526272829303132333435 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- public static class ExMath
- {
- public static int PrevPOT(float value)
- {
- int result = Mathf.ClosestPowerOfTwo(Mathf.CeilToInt(value));
- if (result > value)
- {
- return result/2;
- }
- else
- {
- return result;
- }
- }
- public static int NextPOT(float value)
- {
- int result = Mathf.ClosestPowerOfTwo(Mathf.CeilToInt(value));
-
- if (result >= value)
- {
- return result;
- }
- else
- {
- return result * 2;
- }
- }
- }
|