예제 #1
0
    /**
     * Ocupa la celda indicada y le asigna el contenido y tipo indicado
     **/
    public void occupyAndConfigureCell(Cell cell, GameObject content, Piece.EType type, Piece.EColor color, bool positionate = false)
    {
        cell.occupied = true;

        setCellContent(cell, content, true, positionate);       //destroy
        setCellContentType(cell, type);
        setCellContentColor(cell, color);
    }
예제 #2
0
 public bool existType(Piece.EType type)
 {
     for (int i = 0; i < cells.Count; i++)
     {
         if (cells[i].contentType == type)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #3
0
 public void setAllCellsToType(Piece.EType type)
 {
     for (int i = 0; i < rows; i++)
     {
         for (int j = 0; j < columns; j++)
         {
             //[TODO] asignarle tipo
             getCellAt(j, i).setType();
         }
     }
 }
예제 #4
0
    /*
     * La funcion solo refresca los valores en las celdas
     */
    public void clearCell()
    {
        contentType = Piece.EType.NONE;
        occupied    = false;
        content     = null;

        if ((type & 0x2) == 0x2 || (type & 0x8) == 0x8 || (type & 0x20) == 0x20)
        {
            type      = 1;
            available = true;
        }
    }
예제 #5
0
    public Cell[] getCellsOfSameType(Piece.EType cellType)
    {
        List <Cell> selection = new List <Cell>();

        for (int i = 0; i < cells.Count; i++)
        {
            if (cells[i].contentType == cellType)
            {
                selection.Add(cells[i]);
            }
        }
        return(selection.ToArray());
    }
예제 #6
0
    public void setType(int newCellType = 1)
    {
        type = newCellType;

        if ((type & 0x1) == 0x1)
        {
            cellType    = EType.NORMAL;
            contentType = Piece.EType.NONE;
            occupied    = false;
            available   = true;
            content     = null;
        }

        if ((type & 0x2) == 0x2)
        {
            cellType   = EType.COLORED;
            colorIndex = type >> 6;
            occupied   = true;
            available  = true;
            content    = null;

            updateContentTypeByColorIndex(colorIndex);
        }
        if ((type & 0x4) == 0x4)
        {
            cellType    = EType.EMPTY;
            contentType = Piece.EType.NONE;
            occupied    = true;
            available   = false;
            content     = null;

            sprite_renderer.enabled = false;
        }
        if ((type & 0x8) == 0x8)
        {
            cellType    = EType.OBSTACLE_LETTER;
            contentType = Piece.EType.LETTER_OBSTACLE;
            occupied    = true;
            available   = false;
        }

        if ((type & 0x20) == 0x20)
        {
            cellType    = EType.TUTORIAL_LETTER;
            contentType = Piece.EType.LETTER;
            occupied    = true;
            available   = false;
        }
    }
예제 #7
0
 public void setCellContentType(Cell cell, Piece.EType type)
 {
     cell.contentType = type;
 }
예제 #8
0
 public void setCellContentType(int x, int y, Piece.EType type)
 {
     setCellContentType(getCellAt(x, y), type);
 }
예제 #9
0
 public void setCellContentType(int cellIndex, Piece.EType type)
 {
     setCellContentType(cells[cellIndex], type);
 }
예제 #10
0
 /**
  * Ocupa la celda indicada y le asigna el contenido y tipo indicado
  **/
 public void occupyAndConfigureCell(int cellIndex, GameObject content, Piece.EType type, Piece.EColor color, bool positionate = false)
 {
     occupyAndConfigureCell(cells[cellIndex], content, type, color, positionate);
 }