bool DownSolid(int dice, Pointer temp) { if (DiceRull.isTop(dice)) { temp.y--; if (temp.y <= 0) { return(false); } if (GetRoomType(temp) == 0) { return(true); } } return(false); }
bool RightSolid(int dice, Pointer temp) { if (DiceRull.isRight(dice)) { temp.x++; if (temp.x >= m_MapSize.x) { return(false); } if (GetRoomType(temp) == 0) { return(true); } } return(false); }
bool TopSolid(int dice, Pointer temp) { if (DiceRull.isDown(dice)) { temp.y++; if (temp.y >= m_MapSize.y) { return(false); } if (GetRoomType(temp) == 0) { return(true); } } return(false); }
bool LeftSolid(int dice, Pointer temp) { if (DiceRull.isLeft(dice)) { temp.x--; if (temp.x <= 0) { return(false); } if (GetRoomType(temp) == 0) { return(true); } } return(false); }
Pointer CalcuDiceRull(Pointer index, int dice) { if (DiceRull.isTop(dice) && DownSolid(dice, index) == false) { return(index); } if (DiceRull.isDown(dice) && TopSolid(dice, index) == false) { return(index); } if (DiceRull.isRight(dice) && RightSolid(dice, index) == false) { return(index); } if (DiceRull.isLeft(dice) && LeftSolid(dice, index) == false) { return(index); } //if (LeftNotSolid(dice, index) || RightNotSolid(dice, index) // || DownNotSolid(dice, index) || TopNotSolid(dice, index)) // return index; Pointer nextRoom = index; Debug.Log("dice : " + dice); if (DiceRull.isTop(dice)) { Pointer it = nextRoom; //위에서 2번이 연속으로 배치할경우 현재방의 십자형태로 룸을 바꿔준다 if (GetRoomType(it) == (int)eRoomType.UpperTop) { bool result; do { result = SearchUpperDown(ref it); if (result) { it.y++; } } while(result); } else { SetRoomType(nextRoom, eRoomType.UpperDown); } nextRoom.y--; SetRoomType(nextRoom, eRoomType.UpperTop); return(nextRoom); } else if (DiceRull.isDown(dice)) { Pointer temp = nextRoom; temp.y--; //위에서 2번이 연속으로 배치할경우 현재방의 십자형태로 룸을 바꿔준다 if (temp.y >= 0 && GetRoomType(temp) == (int)eRoomType.UnderDown) { SetRoomType(nextRoom, eRoomType.UnderCross); } else { SetRoomType(nextRoom, eRoomType.UnderDown); } nextRoom.y++; SetRoomType(nextRoom, eRoomType.UnderTop); return(nextRoom); } else if (DiceRull.isLeft(dice)) { nextRoom.x--; SetRoomType(nextRoom, eRoomType.LeftRight); } else if (DiceRull.isRight(dice)) { nextRoom.x++; SetRoomType(nextRoom, eRoomType.LeftRight); } return(nextRoom); }