예제 #1
0
        public void HighlightTileByIndex(IntVector2 index)
        {
            if (!index.IsIn(allHighlightedTiles))
            {
                allHighlightedTiles.Add(index);
            }
            GridCell  cell         = mapAdapter.GetCellByIndex(index);
            CellState currentState = cell.GetCellState();

            if (currentState == CellState.open)
            {
                cell.ApplyHighlight(validTileHighlightPrefab);
            }
            else
            {
                cell.ApplyHighlight(inValidTileHighlightPrefab);
            }
        }
예제 #2
0
        public void HighlightPathWithList(List <IntVector2> indices)
        {
            foreach (IntVector2 index in highlightedPath.Except(indices))
            {
                GridCell cell = mapAdapter.GetCellByIndex(index);
                cell.RemoveHighlight();
                cell.ApplyHighlight(validTileHighlightPrefab);
            }

            foreach (IntVector2 index in indices.Except(highlightedPath))
            {
                GridCell cell = mapAdapter.GetCellByIndex(index);
                cell.RemoveHighlight();
                cell.ApplyHighlight(pathTileHighlightPrefab);
            }

            highlightedPath = indices;
        }