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

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

parent 1215823d
......@@ -109,10 +109,6 @@ public class MapManager : MonoBehaviour {
/// List for the normal Room candidates.
/// </summary>
public RoomInGame[] normalRoomList;
/*/// <summary>
/// List for the item Room candidates.
/// </summary>
public RoomInGame[] itemRoomList;*/
/// <summary>
/// Array for the special Room candidates.
/// </summary>
......@@ -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);
}
te.rooms[i].SetDoors();
}
Destroy(te.gameObject);
}
......@@ -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(originPos.x, Random.insideUnitCircle.y * amount + originPos.y, originPos.z);
amount -= _amount / 40;
//Debug.Log(amount);
yield return null;
}
camera.transform.localPosition = originPos;
......@@ -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);
}
}
//currentTetrimino.transform.position = currentTetrimino.mapCoord * tetrisMapSize + tetrisMapCoord;
}
}
......
......@@ -2,6 +2,20 @@
using System.Collections.Generic;
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>
/// Room class
/// </summary>
......@@ -17,10 +31,11 @@ public class Room : MonoBehaviour
/// 0 for up, 1 for down.
/// doorInfo[0] for left door, doorInfo[1] for right door.
/// </summary>
public int[] doorInfo;
//public int[] doorInfo;
Door doorInfo = new Door();
/// <summary>
/// Stage per rooms.
/// Range from 0 to 4.
/// </summary>
public int stage;
/// <summary>
......@@ -38,11 +53,30 @@ public class Room : MonoBehaviour
/// </summary>
public MapManager.SpecialRoomType specialRoomType;
public int testLeft;
public int testRight;
/// <summary>
/// Select which doors would be opened.
/// </summary>
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;
public class RoomInGame : MonoBehaviour {
/// <summary>
/// The enum for door information.
/// The enum for
/// information.
/// </summary>
public DoorInfo doorInfo;
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