Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created April 18, 2018 10: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/fa30f004fb89837a5d8f12a3bf29976b to your computer and use it in GitHub Desktop.
Save todorok1/fa30f004fb89837a5d8f12a3bf29976b to your computer and use it in GitHub Desktop.
Unityチュートリアル・ガイドを表示するスクリプト。
List<float> GetTimeProtsList(Vector3 speed, Vector3 gravity, int prots){
// 斜方投射後、地面に到達する時刻を計算
float landingTime = -2.0f * speed.y / gravity.y;
// 時刻格納用のリストを作成
List<float> timeProtsList = new List<float>();
// ガイドのプロット数が0なら作成直後の長さ0のリストを返す
if (prots <= 0){
return timeProtsList;
}
// プロット数に応じて、ガイドを表示する位置を計算するための時刻をリストに追加
for (int i = 1; i <= prots; i++){
float timeProt = i * landingTime / prots;
timeProtsList.Add(timeProt);
}
return timeProtsList;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment