public void UpdateInteractableCells(bool ShowGrid, Card_Base card) { InteractableCells = new List <HexCell>(); if (ShowGrid) { if (card != null) { InteractableCells = card.GetCanUseCells(playerCardManager); } else { InteractableCells = playerCardManager.CanMoveCells; } } foreach (HexCell cell in HexGrid.instance.cells) { cell.HighLightCell(InteractableCells.Contains(cell)); } }
private IEnumerator PlayCardProcess() { yield return(new WaitForSeconds(0.5f)); EvaluateGridValue(); bool haveCardToUse = true; while (haveCardToUse) { yield return(new WaitForSeconds(0.02f)); haveCardToUse = false; for (int i = 0; i < cardManager.Cards.Count; i++) { Card_Base card = cardManager.Cards[i]; HexCell cell = null; List <HexCell> canUseCells = card.GetCanUseCells(cardManager); if (canUseCells.Count > 0) { cell = GetMVC(canUseCells); } if (card.CanUseCard(cardManager, cell)) { print("AI use card:" + card); haveCardToUse = true; cardManager.UseCard(cardManager.Cards[i], cell); break; } } if (!haveCardToUse) { cardManager.UpdateCanMoveCells(); if (cardManager.CanMoveCells.Count > 0) { cardManager.SetUnitMoveTo(GetMVC(cardManager.CanMoveCells)); } } } }