private void Awake() { levelButtons = GetComponentsInChildren <LevelMenuButton>(); for (int y = 0; y < numRows; ++y) { for (int x = 0; x < numColumns; ++x) { LevelMenuButton child = GetChild(x, y); child.x = x; child.y = y; } } previousHorizontals = new Dictionary <int, int>(); previousVerticals = new Dictionary <int, int>(); }
public void SelectChild(int x, int y) { LevelMenuButton currentSelected = GetChild(selectedX, selectedY); if (currentSelected != null) { if (currentSelected.state == LevelMenuButton.State.Pressed) { return; } currentSelected.state = LevelMenuButton.State.Idle; } selectedX = x; selectedY = y; GetChild(x, y).state = LevelMenuButton.State.Hovered; }