List<GameObject> drawVerticalWalls(Labirynth labirynth, float yOffset) { List<GameObject> walls = new List<GameObject> (); float scaleFactorZ = 2*spaceZ - 1f; for (int z=1; z<=sizeZ * 2 - 1; z+=2) { for (int x=2; x<=sizeX * 2 -2 ; x+=2) // don't draw edges { if (labirynth.getWalls(x, z).Equals (TileType.WALL)) { Vector3 pos = new Vector3 (-planeSizeX/2f + spaceX * x, wallPrefab.transform.position.y + yOffset, offsetZ + planeSizeZ/2f - spaceZ * z); GameObject obj = (GameObject) Instantiate (wallPrefab, pos, Quaternion.Euler(0, 90, 0)); obj.name = obj.name + labirynth.getParams(x, z); obj.transform.localScale = new Vector3(scaleFactorZ + compensatePillarInnerRadius, wallPrefab.transform.localScale.y, wallPrefab.transform.localScale.z); if (z == sizeZ * 2 - 1) // last row { obj.layer = LayerMask.NameToLayer("1stRowMazeWalls"); } walls.Add(obj); } } } return walls; }
List<GameObject> drawSmallWalls(Labirynth labirynth, float yOffset) { List<GameObject> walls = new List<GameObject> (); for (int z=2; z<=sizeZ * 2; z+=2) // don't draw edges { for (int x=2; x<=sizeX * 2 - 2; x+=2) // don't draw edges { if (labirynth.getWalls(x, z).Equals(TileType.WALL)) { Vector3 pos = new Vector3 (-planeSizeX/2f + spaceX * x, smallWallPrefab.transform.position.y + yOffset, offsetZ + planeSizeZ/2f - spaceZ * z); int angle = Random.Range(0, 4) * 90; GameObject obj = (GameObject)Instantiate (smallWallPrefab, pos, Quaternion.Euler(0, angle, 0)); obj.name = obj.name + labirynth.getParams(x, z); if (z == sizeZ * 2) // last row { obj.layer = LayerMask.NameToLayer("1stRowMazeWalls"); } walls.Add(obj); } } } return walls; }