internal bool ArrangeTiles() { m_nbTilesPerSide = (int)Math.Sqrt(m_tiles.Count); if (m_nbTilesPerSide * m_nbTilesPerSide != m_tiles.Count) { m_nbTilesPerSide = -1; return(false); } m_orderedTiles = new Tile[m_nbTilesPerSide, m_nbTilesPerSide]; var unused = GetAllUnusedTiles(); foreach (Tile tile in unused) { if (PlaceTile(tile, (0, 0))) { if (tile.CheckFit()) { return(true); } } RemoveTileFromPicture(tile); } return(false); }
void Start() { // tilePlacerObject = GameObject.FindWithTag("TilePlacer"); tilePlacerScript = tilePlacerObject.GetComponent <PlaceTile>(); tilePlacerObject.SetActive(false); uiImg_currTileIcon = ui_ImgTileIcon.GetComponent <Image>(); uiTxt_currRoomID = ui_TxtRoomID.GetComponent <Text>(); uiCol_currRoomColorImg = ui_RoomColor.GetComponent <Image>(); uiImg_tileFacingSel_N = ui_TileFacingSel_N.transform.GetComponent <Image>(); uiImg_tileFacingSel_E = ui_TileFacingSel_E.transform.GetComponent <Image>(); uiImg_tileFacingSel_S = ui_TileFacingSel_S.transform.GetComponent <Image>(); uiImg_tileFacingSel_W = ui_TileFacingSel_W.transform.GetComponent <Image>(); tileFacingFlag = 0; uiImg_tileFacingSel_N.enabled = true; uiImg_tileFacingSel_E.enabled = false; uiImg_tileFacingSel_S.enabled = false; uiImg_tileFacingSel_W.enabled = false; }
void Start() { m_pTile = GameObject.Find("Player").GetComponent <PlaceTile>(); m_manager = GameObject.Find("PauseMenu").GetComponent <UIManager>(); m_gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); }