Skip to content

Instantly share code, notes, and snippets.

Last active April 13, 2018 14:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
void CheckDistance(){
if (!isCheckingDistance){
// 距離測定中でなければ何もしない
// 現在位置までの距離を計算する
Vector3 currentPosition = gameObject.transform.position;
float distance = GetDistanceInXZ(initPosition, currentPosition);
// UIテキストに表示
if (rb.IsSleeping()){
// ハイスコアのチェック
stopPosition = currentPosition;
float currentDistance = GetDistanceInXZ(initPosition, stopPosition);
if (currentDistance > highScoreDistance){
highScoreDistance = currentDistance;
// 距離測定中フラグをオフに
isCheckingDistance = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment