// -------------------------------------------------------------------------------------------- public static List <BoardTile> GetPlayableTiles(Game game, Player owner, CardData cardData) { List <BoardTile> toReturn = new List <BoardTile>(); if (cardData.energyRequired > owner.Energy) { // return empty list because this card is too expensive to be palyed. return(toReturn); } if (!string.IsNullOrEmpty(cardData.useSkillId)) { return(Skill.GetTargetableTiles(AppManager.Config.GetSkillData(cardData.useSkillId), game, owner.Hero)); } if (!string.IsNullOrEmpty(cardData.spawnUnitId)) { UnitData unitData = AppManager.Config.GetUnitData(cardData.spawnUnitId); for (int x = 0; x < game.board.width; x++) { for (int y = 0; y < game.board.height; y++) { BoardTile boardTile = game.board.GetTile(x, y); if (Unit.CanSpawnOnTile(unitData, boardTile, owner.Hero)) { toReturn.Add(boardTile); } } } return(toReturn); } return(toReturn); }
// -------------------------------------------------------------------------------------------- public void HighlightBoardTilesForUseSkill(Skill skill) { List <BoardTile> targetableTiles = skill.GetTargetableTiles(); foreach (BoardTile boardTile in targetableTiles) { if (BoardTileView.TryGetView(boardTile, out BoardTileView view)) { view.SetHighlight(skill.DamageDealt > 0 ? BoardTileView.EHighlight.Attack : BoardTileView.EHighlight.Heal); } } }