private void PlaceCavePiece() { int RandNum = UnityEngine.Random.Range(0, cavePieces.Count); CavePiece currenPiece = Instantiate(cavePieces[RandNum], transform.position, Quaternion.identity).GetComponent <CavePiece>(); currenPiece.transform.position = new Vector3(xCor * 8, 0, yCor * 8); cave[xCor, yCor] = currenPiece; }
private void PlaceEnd() { bool isPlaced = false; do { if (xCor >= 0 && yCor >= 0 && xCor < cave.GetLength(0) && yCor < cave.GetLength(1)) { if (cave[xCor, yCor] == null) { CavePiece currenPiece = Instantiate(endRoom, transform.position, Quaternion.identity).GetComponent <CavePiece>(); currenPiece.transform.position = new Vector3(xCor * 8, 0, yCor * 8); cave[xCor, yCor] = currenPiece; isPlaced = true; } } if (isPlaced == false) { MoveCords(); } } while (isPlaced == false); }