Game_CodeMM/Assets/00_scripts/LoadRoomManager.cs
2025-10-08 16:31:53 +08:00

36 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LoadRoomManager : MonoBehaviour
{
[Tooltip("Default Dungeon SO")] public DungeonHomeSO dungeonHomeSo;
[Tooltip("BugStatus Room")] public GameObject roomBugStatue;
[Tooltip("Center Position")] public GameObject startPositionObject;
private void create_room(GameObject room_prefab, Vector3 m_create_position)
{
GameObject room = Instantiate(room_prefab, m_create_position, Quaternion.identity);
room.name = $"room_{room.transform.position}";
}
// Start is called before the first frame update
void Start()
{
foreach (DungeonDataclass item in dungeonHomeSo.return_all_data())
{
if (item.roomType == RoomType.BugStatueRoom)
{
// create_room(controllerRoomPrefab, new Vector3(item.positionX * 1f, item.positionY * 1f, 0));
create_room(roomBugStatue,
startPositionObject.transform.position + new Vector3(item.position.x * item.roomSize,
-item.position.y * item.roomSize, 0));
}
}
}
// Update is called once per frame
void Update()
{
}
}