Mathf
- Abs
- Acos
- Approximately
- Asin
- Atan2
- Atan
- CeilToInt
- Ceil
- Clamp01
- Clamp
- ClosestPowerOfTwo
- Cos
- Deg2Rad
- DeltaAngle
- Epsilon
- Exp
- FloorToInt
- Floor
- Infinity
- InverseLerp
- IsPowerOfTwo
- LerpAngle
- Lerp
- Log10
- Log
- Max
- Min
- MoveTowardsAngle
- MoveTowards
- NegativeInfinity
- NextPowerOfTwo
- PingPong
- PI
- Pow
- Rad2Deg
- Repeat
- RoundToInt
- Round
- Sign
- Sin
- SmoothDampAngle
- SmoothDamp
- SmoothStep
- Sqrt
- Tan
Mathf.IsPowerOfTwo 是否2的幂
static function IsPowerOfTwo (value : int) : bool
Description描述
Returns true if the value is power of two.
如果该值是2的幂,返回true。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Awake() {
Debug.Log(Mathf.IsPowerOfTwo(7));
Debug.Log(Mathf.IsPowerOfTwo(32));
}
}
最后修改:2011年4月16日 Saturday 14:47