Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created May 1, 2018 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todorok1/25b44341d4cd78d00cde7dfdb7ee81e9 to your computer and use it in GitHub Desktop.
Save todorok1/25b44341d4cd78d00cde7dfdb7ee81e9 to your computer and use it in GitHub Desktop.
Unityチュートリアル・ゴルフゲームの進行を制御するスクリプト
void CheckInput(){
// キーが押された時の動きを定義
// Input.GetKeyUpはキーが一度押された後、それが離された時にTrueを返す
if (Input.GetKeyUp(KeyCode.B) && canButtonPress){
isBoostPressed = true;
}
// 上キーが押された時は、角度変更ボタン(上)が押された時の処理を呼ぶ
if (Input.GetKeyDown(KeyCode.UpArrow)){
OnPressedAngleUpButton();
} else if (Input.GetKeyUp(KeyCode.UpArrow)){
OnReleasedAngleButton();
}
// 下キーが押された時は、角度変更ボタン(下)が押された時の処理を呼ぶ
if (Input.GetKeyDown(KeyCode.DownArrow)){
OnPressedAngleDownButton();
} else if (Input.GetKeyUp(KeyCode.DownArrow)){
OnReleasedAngleButton();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment