/// <summary> /// 次に生成する障害物を取得する /// </summary> /// <returns>選択された障害物</returns> StageCip getNextStageCip() { // ランダムで選択する int stageCipIndex = Random.Range(0, stagecips.Count); StageCip nextStageCip = stagecips [stageCipIndex]; return(nextStageCip); }
/// <summary> /// 障害物の生成処理 /// </summary> /// <param name="stageCip">生成する障害物</param> /// <param name="creatPointDepth">生成する深さ</param> /// <param name="count">生成中の障害物のカウント</param> void createStageCip(StageCip stageCip, float creatPointDepth, int count) { StageCip cip = Instantiate <StageCip> (stageCip); cip.transform.position = Vector3.up * creatPointDepth; switch (cip.generatedPattern) { case GameDef.StageCipGeneratedPattern.LINER: // 線形に回転する cip.transform.Rotate(Vector3.up, cip.rotateValue * count + cip.initialValue); break; case GameDef.StageCipGeneratedPattern.PING_PONG: // 半分まで生成すると回転が逆転する if (count < cip.repeatCount / 2) { cip.transform.Rotate(Vector3.up, cip.rotateValue * count + cip.initialValue); } else { cip.transform.Rotate(Vector3.up, cip.rotateValue * (cip.repeatCount - count) + cip.initialValue); } break; case GameDef.StageCipGeneratedPattern.RANDOM: // ランダムで生成する if (cip.rotateValue != 0.0f) { cip.transform.Rotate(Vector3.up, cip.rotateValue * Random.Range(0, (360.0f / cip.rotateValue)) + cip.initialValue); } else { cip.transform.Rotate(Vector3.up, cip.initialValue); } break; } }