32 lines
645 B
Markdown
32 lines
645 B
Markdown
![]() |
#unity/日常积累
|
|||
|
|
|||
|
public static int CeilToInt (float f);
|
|||
|
|
|||
|
## 描述
|
|||
|
|
|||
|
返回大于或等于 `f` 的最小整数。
|
|||
|
|
|||
|
``` cs
|
|||
|
using UnityEngine;
|
|||
|
using System.Collections;
|
|||
|
|
|||
|
public class ExampleClass : MonoBehaviour
|
|||
|
{
|
|||
|
void Start()
|
|||
|
{
|
|||
|
// Prints 10
|
|||
|
Debug.Log(Mathf.CeilToInt(10.0f));
|
|||
|
// Prints 11
|
|||
|
Debug.Log(Mathf.CeilToInt(10.2f));
|
|||
|
// Prints 11
|
|||
|
Debug.Log(Mathf.CeilToInt(10.7f));
|
|||
|
|
|||
|
// Prints -10
|
|||
|
Debug.Log(Mathf.CeilToInt(-10.0f));
|
|||
|
// Prints -10
|
|||
|
Debug.Log(Mathf.CeilToInt(-10.2f));
|
|||
|
// Prints -10
|
|||
|
Debug.Log(Mathf.CeilToInt(-10.7f));
|
|||
|
}
|
|||
|
}
|
|||
|
```
|