private void CreateStartingPoints() { Object obj = Resources.Load("PlayerStartingPoint"); int x = (int)startingRoom.GetMedianPoint().x; int y = (int)startingRoom.GetMedianPoint().z; TileScript2D up = DungeonGenerationUtils.GetUpTile(x, y, tilesMap); TileScript2D down = DungeonGenerationUtils.GetDownTile(x, y, tilesMap); TileScript2D left = DungeonGenerationUtils.GetLeftTile(x, y, tilesMap); TileScript2D right = DungeonGenerationUtils.GetRightTile(x, y, tilesMap); GameObject go = (GameObject)Utils.MyInstantiate(obj); go.transform.position = up.transform.position + new Vector3(0, 1f, 0); go.transform.SetParent(map.transform, false); go = (GameObject)Utils.MyInstantiate(obj); go.transform.position = down.transform.position + new Vector3(0, 1f, 0); go.transform.SetParent(map.transform, false); go = (GameObject)Utils.MyInstantiate(obj); go.transform.position = left.transform.position + new Vector3(0, 1f, 0); go.transform.SetParent(map.transform, false); go = (GameObject)Utils.MyInstantiate(obj); go.transform.position = right.transform.position + new Vector3(0, 1f, 0); go.transform.SetParent(map.transform, false); }
private void CreateWall(GameObject gameObject, int x, int y) { TileScript2D up = DungeonGenerationUtils.GetUpTile(x, y, tilesMap); TileScript2D down = DungeonGenerationUtils.GetDownTile(x, y, tilesMap); TileScript2D left = DungeonGenerationUtils.GetLeftTile(x, y, tilesMap); TileScript2D right = DungeonGenerationUtils.GetRightTile(x, y, tilesMap); UnityEngine.Object obj = null; float degrees = 0; if (IsNullOrFloor(up) && IsNullOrFloor(down)) { obj = Resources.Load("WallCubeH"); } if (IsNullOrFloor(right) && IsNullOrFloor(left)) { obj = Resources.Load("WallCubeH"); degrees = 90; } if (IsWall(up) && IsWall(left)) { obj = Resources.Load("WallAngle"); degrees = 270; } if (IsWall(up) && IsWall(right)) { obj = Resources.Load("WallAngle"); degrees = 180; } if (IsWall(down) && IsWall(left)) { obj = Resources.Load("WallAngle"); degrees = 0; } if (IsWall(down) && IsWall(right)) { obj = Resources.Load("WallAngle"); degrees = 90; } if (obj != null) { GameObject go = (GameObject)Utils.MyInstantiate(obj); go.transform.position = gameObject.transform.position + new Vector3(0, 1.5f, 0); go.transform.Rotate(Vector3.up, degrees); go.transform.SetParent(map.transform, false); } }