void Start() { Player.Init(LevelUI); TestRoom.Init(false, false, false, false); var objectInitializer = new RoomRandomObjectsInitializer(Player.gameObject); objectInitializer.InitRoomObjects(TestRoom); LevelUI.Init(); }
void Start() { Player.Init(LevelUI); // Generate new state var map = LevelGenerator.GenerateMap(); // Generate map object based on state LevelGenerator.GenerateLevelObjects(this, map); LevelUI.Init(); }
bool ShowPage(int page) { if (page < 0 || page >= pageNum) { return(false); } curPage = page; m_dotCtr.SetCurPage(curPage); for (int i = curPage * 10; i < (curPage + 1) * 10; i++) { if (i < GameData.LevelDataList.Count) { if (i - curPage * 10 < m_list.Count) { m_list[i - curPage * 10].Init(GameData.LevelDataList[i]); } else { GameObject go = GameObject.Instantiate(m_levelItemPrefab); go.transform.parent = m_contents; go.transform.localScale = Vector3.one; LevelUI uiCtr = go.GetComponent <LevelUI>(); uiCtr.Init(GameData.LevelDataList[i]); m_list.Add(uiCtr); } } else if (i - curPage * 10 < m_list.Count) { GameObject.Destroy(m_list[i - curPage * 10].gameObject); m_list[i - curPage * 10] = null; } } // for (int i = m_list.Count - 1; i >= 0; i--) { if (m_list[i] == null) { m_list.RemoveAt(i); } } return(true); }