Skip to content

Instantly share code, notes, and snippets.

@todorok1
Last active May 1, 2018 13:14
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/429d90fc9fe834f8851971a968ab6d1c to your computer and use it in GitHub Desktop.
Save todorok1/429d90fc9fe834f8851971a968ab6d1c to your computer and use it in GitHub Desktop.
Unityチュートリアル・ゴルフゲームの進行を制御するスクリプト
// オブジェクト参照のエリアに追加
// 発射ボタンオブジェクトへの参照
[SerializeField]
GameObject boostButtonObject;
// ゴール用UIテキストオブジェクトへの参照
[SerializeField]
GameObject goalTextObject;
// 中略
// Sphereオブジェクトの初期位置格納用ベクトル
// Vector3 initPosition = Vector3.zero;
// -> initPositionを削除
// 中略
// 角度の上限と下限の定義
const float MaxAngle = 180f;
const float MinAngle = 0f;
// 中略
// GuideManagerへの参照のキャッシュ
GuideManager guideManager;
// 以下を追加
// ボールを発射する直前の位置
Vector3 prePosition = Vector3.zero;
// 発射ボタンオブジェクトへの参照
Button boostButton;
// ボタンを押せる状態かどうかのフラグ
bool canButtonPress = true;
// ゴールのタグ
string goalTag = "Finish";
// ゴール接触フラグ
bool isTouchingGoal = false;
// ゴール済みフラグ
bool hasReachedGoal = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment