Fixed rooms not loading as prefabs
This commit is contained in:
parent
438d3a9a79
commit
0ade17a3c8
3 changed files with 10737 additions and 85695 deletions
|
|
@ -3091,8 +3091,8 @@ Camera:
|
||||||
m_GameObject: {fileID: 2029992415}
|
m_GameObject: {fileID: 2029992415}
|
||||||
m_Enabled: 1
|
m_Enabled: 1
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_ClearFlags: 1
|
m_ClearFlags: 2
|
||||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
|
m_BackGroundColor: {r: 0.031372372, g: 0.040399473, b: 0.047169805, a: 1}
|
||||||
m_projectionMatrixMode: 1
|
m_projectionMatrixMode: 1
|
||||||
m_GateFitMode: 2
|
m_GateFitMode: 2
|
||||||
m_FOVAxisMode: 0
|
m_FOVAxisMode: 0
|
||||||
|
|
@ -3117,7 +3117,7 @@ Camera:
|
||||||
far clip plane: 1000
|
far clip plane: 1000
|
||||||
field of view: 60
|
field of view: 60
|
||||||
orthographic: 1
|
orthographic: 1
|
||||||
orthographic size: 5
|
orthographic size: 7.35
|
||||||
m_Depth: -1
|
m_Depth: -1
|
||||||
m_CullingMask:
|
m_CullingMask:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using DungeonMapGenerator;
|
using DungeonMapGenerator;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
|
using UnityEditor;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -25,39 +26,28 @@ namespace DungeonGenerator
|
||||||
GameObject monsterRoomPrefab = Resources.Load<GameObject>(MONSTER_ROOM);
|
GameObject monsterRoomPrefab = Resources.Load<GameObject>(MONSTER_ROOM);
|
||||||
GameObject normalRoomPrefab = Resources.Load<GameObject>(NORMAL_ROOM);
|
GameObject normalRoomPrefab = Resources.Load<GameObject>(NORMAL_ROOM);
|
||||||
|
|
||||||
GameObject bossRoomGO = Object.Instantiate(bossRoomPrefab,
|
GameObject bossRoomGO = PrefabUtility.InstantiatePrefab(bossRoomPrefab, gameObject.transform) as GameObject;
|
||||||
ConvertToUnityPosition(map.GetBossRoom().GetCenterOfRoom(), map.Width, map.Height),
|
bossRoomGO.transform.position = ConvertToUnityPosition(map.GetBossRoom().GetCenterOfRoom(), map.Width, map.Height);
|
||||||
Quaternion.identity,
|
|
||||||
gameObject.transform);
|
|
||||||
_roomIdToGameObject[map.GetBossRoom().Id] = bossRoomGO;
|
_roomIdToGameObject[map.GetBossRoom().Id] = bossRoomGO;
|
||||||
|
|
||||||
foreach (var monsterRoom in map.GetMonsterRooms())
|
foreach (var monsterRoom in map.GetMonsterRooms())
|
||||||
{
|
{
|
||||||
GameObject monsterRoomGO = Object.Instantiate(
|
GameObject monsterRoomGO = PrefabUtility.InstantiatePrefab(monsterRoomPrefab, gameObject.transform) as GameObject;
|
||||||
monsterRoomPrefab,
|
monsterRoomGO.transform.position = ConvertToUnityPosition(monsterRoom.GetCenterOfRoom(), map.Width, map.Height);
|
||||||
ConvertToUnityPosition(monsterRoom.GetCenterOfRoom(), map.Width, map.Height),
|
|
||||||
Quaternion.identity,
|
|
||||||
gameObject.transform);
|
|
||||||
_roomIdToGameObject[monsterRoom.Id] = monsterRoomGO;
|
_roomIdToGameObject[monsterRoom.Id] = monsterRoomGO;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var normalRoom in map.GetNormalRooms())
|
foreach (var normalRoom in map.GetNormalRooms())
|
||||||
{
|
{
|
||||||
GameObject normalRoomGO = Object.Instantiate(
|
GameObject normalRoomGO = PrefabUtility.InstantiatePrefab(normalRoomPrefab, gameObject.transform) as GameObject;
|
||||||
normalRoomPrefab,
|
normalRoomGO.transform.position = ConvertToUnityPosition(normalRoom.GetCenterOfRoom(), map.Width, map.Height);
|
||||||
ConvertToUnityPosition(normalRoom.GetCenterOfRoom(), map.Width, map.Height),
|
|
||||||
Quaternion.identity,
|
|
||||||
gameObject.transform);
|
|
||||||
_roomIdToGameObject[normalRoom.Id] = normalRoomGO;
|
_roomIdToGameObject[normalRoom.Id] = normalRoomGO;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var entranceRoom in map.GetEntranceRooms())
|
foreach (var entranceRoom in map.GetEntranceRooms())
|
||||||
{
|
{
|
||||||
GameObject entranceRoomGO = Object.Instantiate(
|
GameObject entranceRoomGO = PrefabUtility.InstantiatePrefab(normalRoomPrefab, gameObject.transform) as GameObject;
|
||||||
normalRoomPrefab,
|
entranceRoomGO.transform.position = ConvertToUnityPosition(entranceRoom.GetCenterOfRoom(), map.Width, map.Height);
|
||||||
ConvertToUnityPosition(entranceRoom.GetCenterOfRoom(), map.Width, map.Height),
|
|
||||||
Quaternion.identity,
|
|
||||||
gameObject.transform);
|
|
||||||
entranceRoomGO.GetComponent<Room>().IsEntrance = true;
|
entranceRoomGO.GetComponent<Room>().IsEntrance = true;
|
||||||
_roomIdToGameObject[entranceRoom.Id] = entranceRoomGO;
|
_roomIdToGameObject[entranceRoom.Id] = entranceRoomGO;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue