Skip to content

Instantly share code, notes, and snippets.

@todorok1
Last active May 1, 2018 13:09
  • 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
Embed
What would you like to do?
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