private void GetHighwayPieceLength() { HighwayPiece highwayPiece = GetHighwayPiece(); HighwayPieceLength = highwayPiece.GetLength(); ReturnToQueue(highwayPiece); }
private void AddHighwayPieces(int num) { for (int i = 0; i < num; i++) { HighwayPiece highwayPiece = Instantiate(_highwayPiece, transform, true); highwayPiece.gameObject.SetActive(false); _highwayPieces.Enqueue(highwayPiece); } }
private void SpawnHighway() { for (float f = ChunkCenter.z - _chunkLength / 2; f + Mathf.Epsilon < ChunkCenter.z + _chunkLength / 2 - _highwayPool.HighwayPieceLength / 2;) { HighwayPiece highwayPiece = _highwayPool.GetHighwayPiece(); highwayPiece.transform.position = new Vector3(0, 0, f); highwayPiece.gameObject.SetActive(true); _highwayPieces.Add(highwayPiece); f += _highwayPool.HighwayPieceLength; } }
public void ReturnToQueue(HighwayPiece highwayPiece) { _highwayPieces.Enqueue(highwayPiece); highwayPiece.gameObject.SetActive(false); }