Created
July 3, 2018 07:23
-
-
Save todorok1/8820ba5591895f6cd6ba35baa408ac38 to your computer and use it in GitHub Desktop.
MathfのCeilを使った時の動作
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MathfCheck : MonoBehaviour { | |
void Start(){ | |
CeilTest(); | |
} | |
void CeilTest(){ | |
float value = 7.65f; | |
Debug.Log("value : " + value + " / Ceil : " + Mathf.Ceil(value)); | |
Debug.Log("value : " + value + " / CeilToInt : " + Mathf.CeilToInt(value)); | |
value = -8.76f; | |
Debug.Log("value : " + value + " / Ceil : " + Mathf.Ceil(value)); | |
Debug.Log("value : " + value + " / CeilToInt : " + Mathf.CeilToInt(value)); | |
float ceiledValue = Mathf.Ceil(value); | |
// 明示的にキャストが必要 | |
int ceildIntValue = (int) Mathf.Ceil(value); | |
float ceiledToIntValueToFloat = Mathf.CeilToInt(value); | |
int ceiledToIntValueToInt = Mathf.CeilToInt(value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment