Guest User

Untitled

a guest
Apr 21st, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. void CheckDistance(){
  2. if (!isCheckingDistance){
  3. // 距離測定中でなければ何もしない
  4. return;
  5. }
  6.  
  7. // 現在位置までの距離を計算する
  8. Vector3 currentPosition = gameObject.transform.position;
  9. float distance = GetDistanceInXZ(initPosition, currentPosition);
  10.  
  11. // UIテキストに表示
  12. SetDistanceText(distance);
  13.  
  14. if (rb.IsSleeping()){
  15. // ハイスコアのチェック
  16. stopPosition = currentPosition;
  17. float currentDistance = GetDistanceInXZ(initPosition, stopPosition);
  18.  
  19. if (currentDistance > highScoreDistance){
  20. highScoreDistance = currentDistance;
  21. }
  22. SetHighScoreText(highScoreDistance);
  23.  
  24. // 距離測定中フラグをオフに
  25. isCheckingDistance = false;
  26. }
  27. }
Add Comment
Please, Sign In to add comment