Skip to content

Instantly share code, notes, and snippets.

@todorok1
Last active May 1, 2018 13:09
Show Gist options
  • Save todorok1/d9613b76c0d67a10261dbf2e5b2f6a25 to your computer and use it in GitHub Desktop.
Save todorok1/d9613b76c0d67a10261dbf2e5b2f6a25 to your computer and use it in GitHub Desktop.
Unityチュートリアル・ゴルフゲームの進行を制御するスクリプト
void FixedUpdate(){
// 距離の測定
CheckDistance();
// ゴールしたかどうかの確認
CheckSphereState();
if (!isBoostPressed){
// キーまたはボタンが押されていなければ
// 処理の切り替えをせず抜ける
return;
}
// Boostボタンが押された場合に以下の処理を行う
canButtonPress = false;
boostButton.interactable = canButtonPress;
// ボールの発射処理
BoostSphere();
// 飛行中フラグの切り替え
isFlying = true;
// どちらの処理をしてもボタン押下フラグをfalseに
isBoostPressed = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment