void SpawnRelocButton(int level) { Transform relocationHolder = PlayerUI.instance.relocationHolder.transform; GameObject prefab = PlayerUI.instance.relocationButton; GameObject relocButton = Instantiate(prefab, relocationHolder); RelocPanel panel = relocButton.GetComponent <RelocPanel>(); panel.SetData(level); }
public void SetRelocationPanel() { Transform relocationPanel = PlayerUI.instance.relocationPanel.transform; Transform relocationHolder = PlayerUI.instance.relocationHolder.transform; Transform child = relocationHolder.GetChild(CurrentDungeonLevel - 1); RelocPanel panel = child.GetComponent <RelocPanel>(); lastRelocPanel?.UnMarkPlayer(); panel.MarkPlayer(); lastRelocPanel = panel; //Activate panel relocationPanel.gameObject.SetActive(true); }
public void SetData(int level) { if (level % 2 == 0) { circleButton.anchorMax = new Vector2(1, 0.5f); circleButton.anchorMin = new Vector2(1, 0.5f); circleButton.anchoredPosition = new Vector2(-circleButton.anchoredPosition.x, circleButton.anchoredPosition.y); upLine.localScale = new Vector3(-1, 1, 1); downLine.localScale = new Vector3(-1, -1, 1); playerText.anchoredPosition = new Vector2(-playerText.anchoredPosition.x, playerText.anchoredPosition.y); } levelNumber.text = level.ToString(); button.indexPoint = level; if (level > 1 && level < Relocation.dungeonSize) { Debug.Log("!!!!!"); upLine.gameObject.SetActive(true); int myIndex = transform.GetSiblingIndex(); Transform neighbour = transform.parent.GetChild(myIndex - 1); RelocPanel neighbourReloc = neighbour.GetComponent <RelocPanel>(); neighbourReloc.downLine.gameObject.SetActive(true); } }