// Update is called once per frame void Update() { if (player.transform.position.y < -loopcip.depth * loopcipcount) { TonnelLoop tail = loopcips [GameDef.TONNEL_LOOP_SIZE - 1]; loopcips.RemoveAt(GameDef.TONNEL_LOOP_SIZE - 1); tail.transform.position = tail.transform.position + (Vector3.down * (loopcip.depth * GameDef.TONNEL_LOOP_SIZE)); loopcipcount++; loopcips.Insert(0, tail); } }
// Use this for initialization void Start() { // ステージ初期化 for (int index = 0; index < GameDef.TONNEL_LOOP_SIZE; index++) { TonnelLoop loop = Instantiate <TonnelLoop> (loopcip); loop.transform.parent = transform; loopcips.Add(Instantiate <TonnelLoop>(loopcip)); } // 外壁の初期位置を設定 for (int index = 0; index < GameDef.TONNEL_LOOP_SIZE; index++) { Vector3 position = loopcips [GameDef.TONNEL_LOOP_SIZE - 1 - index].transform.position + Vector3.up * ((1 - index) * loopcip.depth); loopcips [GameDef.TONNEL_LOOP_SIZE - 1 - index].transform.position = position; } // 障害物の生成を開始 StartCoroutine(createStage()); }