c
This commit is contained in:
@@ -59,10 +59,10 @@ namespace Hallucinate.GameSetup.Maze
|
||||
// Bước 1: Khởi tạo tất cả các tầng mê cung
|
||||
for (int i = 0; i < mazes.Length; i++)
|
||||
{
|
||||
mazes[i].width = width;
|
||||
mazes[i].depth = depth;
|
||||
mazes[i].level = i;
|
||||
mazes[i].Build(); // Lưu ý: Hàm Build này của bạn nên được tối ưu để KHÔNG Instantiate Model vội.
|
||||
// mazes[i].width = width;
|
||||
// mazes[i].depth = depth;
|
||||
// mazes[i].level = i;
|
||||
// mazes[i].Build(); // Lưu ý: Hàm Build này của bạn nên được tối ưu để KHÔNG Instantiate Model vội.
|
||||
}
|
||||
|
||||
// Bước 2: Tạo điểm nối giữa các cặp tầng (0->1, 1->2, 2->3...)
|
||||
@@ -80,14 +80,14 @@ namespace Hallucinate.GameSetup.Maze
|
||||
{
|
||||
// Nếu cả Tầng Dưới và Tầng Trên đều đang là đường đi (Path) ở tọa độ này
|
||||
// (Bạn cần đổi điều kiện này cho khớp với Enum/Class thực tế của bạn)
|
||||
bool isCurrentFloorPath =
|
||||
currentFloor.piecePlace[x, z].piece == MazeGrid.PieceType.Vertical_Straight;
|
||||
bool isNextFloorPath = nextFloor.piecePlace[x, z].piece == MazeGrid.PieceType.Vertical_Straight;
|
||||
|
||||
if (isCurrentFloorPath && isNextFloorPath)
|
||||
{
|
||||
possibleConnections.Add(new Vector2Int(x, z));
|
||||
}
|
||||
// bool isCurrentFloorPath =
|
||||
// currentFloor.piecePlace[x, z].piece == MazeGrid.PieceType.Vertical_Straight;
|
||||
// bool isNextFloorPath = nextFloor.piecePlace[x, z].piece == MazeGrid.PieceType.Vertical_Straight;
|
||||
//
|
||||
// if (isCurrentFloorPath && isNextFloorPath)
|
||||
// {
|
||||
// possibleConnections.Add(new Vector2Int(x, z));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,21 +104,21 @@ namespace Hallucinate.GameSetup.Maze
|
||||
int x = pos.x;
|
||||
int z = pos.y;
|
||||
|
||||
// Xóa model đường đi cũ (nếu hàm Build() đã lỡ Instantiate)
|
||||
if (currentFloor.piecePlace[x, z].model != null) Destroy(currentFloor.piecePlace[x, z].model);
|
||||
if (nextFloor.piecePlace[x, z].model != null) Destroy(nextFloor.piecePlace[x, z].model);
|
||||
// // Xóa model đường đi cũ (nếu hàm Build() đã lỡ Instantiate)
|
||||
// if (currentFloor.piecePlace[x, z].model != null) Destroy(currentFloor.piecePlace[x, z].model);
|
||||
// if (nextFloor.piecePlace[x, z].model != null) Destroy(nextFloor.piecePlace[x, z].model);
|
||||
//
|
||||
// // TÍNH TOẠ ĐỘ Y CHUẨN XÁC: Y = Tầng * Độ_Cao_Tầng
|
||||
// Vector3 upManHolePos = new Vector3(x * currentFloor.scale, currentFloor.level * floorHeight,
|
||||
// z * currentFloor.scale);
|
||||
// Vector3 ladderManPos = new Vector3(x * nextFloor.scale, nextFloor.level * floorHeight,
|
||||
// z * nextFloor.scale);
|
||||
|
||||
// TÍNH TOẠ ĐỘ Y CHUẨN XÁC: Y = Tầng * Độ_Cao_Tầng
|
||||
Vector3 upManHolePos = new Vector3(x * currentFloor.scale, currentFloor.level * floorHeight,
|
||||
z * currentFloor.scale);
|
||||
Vector3 ladderManPos = new Vector3(x * nextFloor.scale, nextFloor.level * floorHeight,
|
||||
z * nextFloor.scale);
|
||||
|
||||
// Sinh Model mới tại điểm đã chốt
|
||||
currentFloor.piecePlace[x, z].model =
|
||||
Instantiate(straightManHoleUp, upManHolePos, Quaternion.identity);
|
||||
nextFloor.piecePlace[x, z].model =
|
||||
Instantiate(straightManHoleLadder, ladderManPos, Quaternion.identity);
|
||||
// // Sinh Model mới tại điểm đã chốt
|
||||
// currentFloor.piecePlace[x, z].model =
|
||||
// Instantiate(straightManHoleUp, upManHolePos, Quaternion.identity);
|
||||
// nextFloor.piecePlace[x, z].model =
|
||||
// Instantiate(straightManHoleLadder, ladderManPos, Quaternion.identity);
|
||||
|
||||
// Cập nhật loại dữ liệu để hệ thống ghi nhận đây là ô cầu thang
|
||||
// currentFloor.piecePlace[x, z].piece = Maze.PieceType.StairsUp; (Nếu bạn có enum này)
|
||||
|
||||
@@ -17,6 +17,11 @@ namespace Hallucinate.GameSetup.Maze
|
||||
public GameObject pathPrefab;
|
||||
public GameObject startPrefab;
|
||||
public GameObject endPrefab;
|
||||
|
||||
[Header("Room Pieces")]
|
||||
public GameObject wallpiece;
|
||||
public GameObject floorpiece;
|
||||
public GameObject cellingpiece;
|
||||
|
||||
[Header("Corridor Types")]
|
||||
public GameObject corridorStraight;
|
||||
|
||||
Reference in New Issue
Block a user