void SpawnBG() { BGChunk newBG = _bg[Random.Range(0, _bg.Length)]; Vector3 spawnPosition = new Vector3((_bgChunk.Position.x + 40.5f) + (newBG.Size.x / 2f) + 0, _bgChunk.Position.y, _bgChunk.Position.z); _bgChunk = Instantiate(newBG, spawnPosition, Quaternion.identity); _spawnThreshold += newBG.Size.x; _bgChunk.transform.SetParent(transform); }
private void Start() { _currentChunk = FindObjectOfType <LevelChunk>(); _bgChunk = FindObjectOfType <BGChunk>(); }