Commit 36e10cf3 authored by 18손재민's avatar 18손재민

방 생성할 때 양 옆에 방이 있으면 문 어디 뚫릴지 정보 저장함

parent 1215823d
...@@ -109,10 +109,6 @@ public class MapManager : MonoBehaviour { ...@@ -109,10 +109,6 @@ public class MapManager : MonoBehaviour {
/// List for the normal Room candidates. /// List for the normal Room candidates.
/// </summary> /// </summary>
public RoomInGame[] normalRoomList; public RoomInGame[] normalRoomList;
/*/// <summary>
/// List for the item Room candidates.
/// </summary>
public RoomInGame[] itemRoomList;*/
/// <summary> /// <summary>
/// Array for the special Room candidates. /// Array for the special Room candidates.
/// </summary> /// </summary>
...@@ -638,6 +634,7 @@ public class MapManager : MonoBehaviour { ...@@ -638,6 +634,7 @@ public class MapManager : MonoBehaviour {
{ {
Instantiate(normalRoomList[Random.Range(0, normalRoomList.Length)], te.rooms[i].transform.position + new Vector3(0, 0, 2), Quaternion.identity, te.rooms[i].transform); Instantiate(normalRoomList[Random.Range(0, normalRoomList.Length)], te.rooms[i].transform.position + new Vector3(0, 0, 2), Quaternion.identity, te.rooms[i].transform);
} }
te.rooms[i].SetDoors();
} }
Destroy(te.gameObject); Destroy(te.gameObject);
} }
...@@ -706,7 +703,6 @@ public class MapManager : MonoBehaviour { ...@@ -706,7 +703,6 @@ public class MapManager : MonoBehaviour {
//transform.localPosition = new Vector3(Random.insideUnitCircle.x * amount + originPos.x, originPos.y, originPos.z); //transform.localPosition = new Vector3(Random.insideUnitCircle.x * amount + originPos.x, originPos.y, originPos.z);
//transform.localPosition = new Vector3(originPos.x, Random.insideUnitCircle.y * amount + originPos.y, originPos.z); //transform.localPosition = new Vector3(originPos.x, Random.insideUnitCircle.y * amount + originPos.y, originPos.z);
amount -= _amount / 40; amount -= _amount / 40;
//Debug.Log(amount);
yield return null; yield return null;
} }
camera.transform.localPosition = originPos; camera.transform.localPosition = originPos;
...@@ -752,7 +748,6 @@ public class MapManager : MonoBehaviour { ...@@ -752,7 +748,6 @@ public class MapManager : MonoBehaviour {
currentGhost.transform.position = new Vector3(currentGhost.mapCoord.x * tetrisMapSize, tetrisYCoord[(int)currentGhost.mapCoord.y], currentGhost.mapCoord.z * tetrisMapSize); currentGhost.transform.position = new Vector3(currentGhost.mapCoord.x * tetrisMapSize, tetrisYCoord[(int)currentGhost.mapCoord.y], currentGhost.mapCoord.z * tetrisMapSize);
} }
} }
//currentTetrimino.transform.position = currentTetrimino.mapCoord * tetrisMapSize + tetrisMapCoord;
} }
} }
......
...@@ -2,6 +2,20 @@ ...@@ -2,6 +2,20 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
class Door
{
/// <summary>
/// Door info of left door.
/// 0 for lowest door, 1 for middle door, 2 for highest door.
/// </summary>
public int left;
/// <summary>
/// Door info of right door.
/// 0 for lowest door, 1 for middle door, 2 for highest door.
/// </summary>
public int right;
}
/// <summary> /// <summary>
/// Room class /// Room class
/// </summary> /// </summary>
...@@ -17,10 +31,11 @@ public class Room : MonoBehaviour ...@@ -17,10 +31,11 @@ public class Room : MonoBehaviour
/// 0 for up, 1 for down. /// 0 for up, 1 for down.
/// doorInfo[0] for left door, doorInfo[1] for right door. /// doorInfo[0] for left door, doorInfo[1] for right door.
/// </summary> /// </summary>
public int[] doorInfo; //public int[] doorInfo;
Door doorInfo = new Door();
/// <summary> /// <summary>
/// Stage per rooms. /// Stage per rooms.
/// Range from 0 to 4.
/// </summary> /// </summary>
public int stage; public int stage;
/// <summary> /// <summary>
...@@ -38,11 +53,30 @@ public class Room : MonoBehaviour ...@@ -38,11 +53,30 @@ public class Room : MonoBehaviour
/// </summary> /// </summary>
public MapManager.SpecialRoomType specialRoomType; public MapManager.SpecialRoomType specialRoomType;
public int testLeft;
public int testRight;
/// <summary> /// <summary>
/// Select which doors would be opened. /// Select which doors would be opened.
/// </summary> /// </summary>
public void SetDoors() public void SetDoors()
{ {
if (mapCoord.x < MapManager.width - 1 && MapManager.mapGrid[(int)mapCoord.x + 1, (int)mapCoord.y] != null)
{
doorInfo.right = MapManager.mapGrid[(int)mapCoord.x + 1, (int)mapCoord.y].doorInfo.left;
}
else
{
doorInfo.right = Random.Range(0, 3);
}
if (mapCoord.x > 0 && MapManager.mapGrid[(int)mapCoord.x - 1, (int)mapCoord.y] != null)
{
doorInfo.left = MapManager.mapGrid[(int)mapCoord.x - 1, (int)mapCoord.y].doorInfo.right;
}
else
{
doorInfo.left = Random.Range(0, 3);
}
testLeft = doorInfo.left;
testRight = doorInfo.right;
} }
} }
...@@ -5,7 +5,8 @@ using UnityEngine; ...@@ -5,7 +5,8 @@ using UnityEngine;
public class RoomInGame : MonoBehaviour { public class RoomInGame : MonoBehaviour {
/// <summary> /// <summary>
/// The enum for door information. /// The enum for
/// information.
/// </summary> /// </summary>
public DoorInfo doorInfo; public DoorInfo doorInfo;
public enum DoorInfo { None, Left, Right, Both }; public enum DoorInfo { None, Left, Right, Both };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment