Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CheckDistance(){
- if (!isCheckingDistance){
- // 距離測定中でなければ何もしない
- return;
- }
- // 現在位置までの距離を計算する
- Vector3 currentPosition = gameObject.transform.position;
- float distance = GetDistanceInXZ(initPosition, currentPosition);
- // UIテキストに表示
- SetDistanceText(distance);
- if (rb.IsSleeping()){
- // ハイスコアのチェック
- stopPosition = currentPosition;
- float currentDistance = GetDistanceInXZ(initPosition, stopPosition);
- if (currentDistance > highScoreDistance){
- highScoreDistance = currentDistance;
- }
- SetHighScoreText(highScoreDistance);
- // 距離測定中フラグをオフに
- isCheckingDistance = false;
- }
- }
Add Comment
Please, Sign In to add comment