Exemple #1
0
    void SetSelectedCell(HexCell cell)
    {
        if (cell == selected)
        {
            return;
        }

        if (selected != null)
        {
            SetCellCollor(selected, selected.originalColor);
            SetNeighborsColor(selected, selected.originalColor);
            selected.Clear();
        }

        selected = cell;
    }
Exemple #2
0
    public void HiglightCell(int column, int row)
    {
        if (gameState.IsBlocked)
        {
            return;
        }

        int     index = GetCellIndex(column, row);
        HexCell cell  = cells[index];

        higlightedCell = cell;

        if (cell == selectedCell)
        {
            GetComponentInChildren <CursorManager>().SetCursor(CursorManager.CursorType.Arrow);
            return;
        }

        RemoveSelection();

        if (selectedCell)
        {
            List <HexCell> path = MakePath(selectedCell, cell);

            // Remove active cell
            if (path.Count > 0)
            {
                path.RemoveAt(path.Count - 1);
            }

            foreach (HexCell pathCell in path)
            {
                pathCell.Draw(cell.pathSprite);
            }
        }

        if (cell.IsPassable())
        {
            GetComponentInChildren <CursorManager>().SetCursor(CursorManager.CursorType.Walk);
            cell.Clear();
            cell.Draw(cell.outlineSprite);
        }
        else
        {
            GetComponentInChildren <CursorManager>().SetCursor(CursorManager.CursorType.Stop);
        }
    }
Exemple #3
0
        private bool BulldozeCell(HexCell cell)
        {
            // The cell has nothing to destroy
            if (cell.IsClear())
            {
                return(false);
            }

            // Makes sure you can only bulldoze nobody's or your pawns
            if (cell.Pawn.owner != null && cell.Pawn.owner != G.PC)
            {
                return(false);
            }

            // Checks if the price can be paid
            if (G.PC.CannotAfford(bulldozeCost))
            {
                return(false);
            }

            G.PC.ConsumeMoney(bulldozeCost);
            cell.Clear();
            return(true);
        }