private void OnMouseOver() { hexSelectionManager.MouseEnteredTile(tilePrefab); var actions = HexActionManager.getViableActions(uiManager.GetActivePlayer(), tilePrefab); if (actions.Count == 1) { GetComponentInChildren <TextMesh>().text = actions[0].GetTipText(uiManager.GetActivePlayer(), tilePrefab); } else { GetComponentInChildren <TextMesh>().text = ""; } }
private void HandleClick() { string errMsg = ""; var actions = HexActionManager.getViableActions (uiManager.GetActivePlayer(), tilePrefab); Debug.Log($"I clicked as {uiManager.GetActivePlayer().Id}"); if (actions.Count == 1) { if (actions[0].canDoAction(uiManager.GetActivePlayer(), tilePrefab, ref errMsg)) { actions[0].doAction(uiManager.GetActivePlayer(), tilePrefab); } else { Debug.Log(errMsg); } } else if (actions.Count > 1) { hexSelectionManager.InitializeHexActionMenu(); foreach (IHexAction hexAction in actions) { Button button = hexSelectionManager.AddActionToHexActionMenu(hexAction.displayName + " " + hexAction.GetTipText(uiManager.GetActivePlayer(), tilePrefab)); button.onClick.AddListener(delegate { hexAction.doAction(uiManager.GetActivePlayer(), tilePrefab); hexSelectionManager.HideHexActionMenu(); }); if (!hexAction.canDoAction(uiManager.GetActivePlayer(), tilePrefab)) { button.interactable = false; } } hexSelectionManager.ShowHexActionMenu(tilePrefab); } }