Created
April 13, 2018 10:07
-
-
Save todorok1/1e4bfb024acda9b5d37140a35db86a60 to your computer and use it in GitHub Desktop.
Unityチュートリアル・ボールの飛距離をゲーム画面に表示するスクリプト。
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
void CheckDistance(){ | |
if (!isCheckingDistance){ | |
// 距離測定中でなければ何もしない | |
return; | |
} | |
if (rb.IsSleeping()){ | |
// スリープモードに入ったことを検知したら距離を出力 | |
stopPosition = gameObject.transform.position; | |
float distance = GetDistanceInXZ(initPosition, stopPosition); | |
// UIテキストに表示 | |
SetDistanceText(distance); | |
// 距離測定中フラグをオフに | |
isCheckingDistance = false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment