Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created April 24, 2018 09:32
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/e658c9e93028e0e2446715112a6c2595 to your computer and use it in GitHub Desktop.
Save todorok1/e658c9e93028e0e2446715112a6c2595 to your computer and use it in GitHub Desktop.
Unityチュートリアル・角度に合わせて矢印を動かすスクリプト。
// PowerMeterオブジェクトへの参照
[SerializeField]
GameObject powerMeterObject;
// ここから追加
// 角度を表す矢印オブジェクト
[SerializeField]
GameObject angleArrowObject;
// 角度変更ボタン(上)
[SerializeField]
GameObject angleArrowUpButtonObject;
// 角度変更ボタン(下)
[SerializeField]
GameObject angleArrowDownButtonObject;
// GuideParentオブジェクトへの参照
[SerializeField]
GameObject guideManagerObject;
// 追加ここまで
// 中略
// [SerializeField]を外す
// X軸からの角度
float forceAngle = 45.0f;
// 中略
// 角度増加中か減少中か
const int AngleIncreasing = 1;
const int AngleDecreasing = -1;
// 角度の増分
int angleDelta;
// 矢印オブジェクトのRect Transformへの参照のキャッシュ
RectTransform arrowRt;
// 角度の上限と下限の定義
const float MaxAngle = 90f;
const float MinAngle = 0f;
// Buttonコンポーネントへの参照のキャッシュ
Button angleUpButton;
Button angleDownButton;
// GuideManagerへの参照のキャッシュ
GuideManager guideManager;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment