예제 #1
0
 public void updateMove(Cell cell1, Cell cell2, CellRow[] board)
 {
     if ((Mathf.Abs(cell2.getCol() - cell1.getCol()) == 2) && (Mathf.Abs(cell2.getRow() - cell1.getRow()) == 2))
     {
         CellRow cr = board[cell1.getRow() + 1];
         Cell    c;
         if (cell2.getCol() - cell1.getCol() == 2)
         {
             cell2.setType(cell1.getType());
             cell1.setType(1);
             cr.getCell(cell1.getCol() + 1).setType(1);
         }
         else
         {
             cell2.setType(cell1.getType());
             cell1.setType(1);
             cr.getCell(cell1.getCol() - 1).setType(1);
         }
     }
     else
     {
         if ((Mathf.Abs(cell2.getCol() - cell1.getCol()) == 1) && (Mathf.Abs(cell2.getRow() - cell1.getRow()) == 1))
         {
             cell2.setType(cell1.getType());
             cell1.setType(1);
         }
     }
 }
예제 #2
0
    public void crownMeBitch(CellRow[] board)
    {
        CellRow cr0 = board[0];
        CellRow cr7 = board[7];

        for (int i = 0; i < 7; i++)
        {
            if (cr0.getCell(i).getType() == 4)
            {
                cr0.getCell(i).setType(5);
            }
        }
        for (int i = 0; i < 7; i++)
        {
            if (cr7.getCell(i).getType() == 2)
            {
                cr7.getCell(i).setType(3);
            }
        }
    }
예제 #3
0
 public int[,] makeItEasy(CellRow[] board)
 {
     int[,] intBoard = new int[8, 8];
     for (int i = 0; i < 8; i++)
     {
         CellRow cr = board[i];
         for (int k = 0; k < 8; k++)
         {
             Cell c = cr.getCell(k);
             intBoard[i, k] = c.getType();
         }
     }
     return(intBoard);
 }
예제 #4
0
 public bool validPlayerKill(Cell cell1, Cell cell2, CellRow[] board)
 {
     //for reg piece
     if (cell1.getType() == 2)
     {
         if (cell2.getType() == 1)
         {
             //for single jump
             else if ((Mathf.Abs(cell2.getCol() - cell1.getCol()) == 2) && (cell2.getRow() - cell1.getRow() == 2))
             {
                 CellRow cr = board[cell1.getRow() + 1];
                 Cell    c;
                 if (cell2.getCol() - cell1.getCol() == 2)
                 {
                     c = cr.getCell(cell1.getCol() + 1);
                 }
                 else
                 {
                     c = cr.getCell(cell1.getCol() - 1);
                 }
                 if (c.getType() == 4 || c.getType() == 5)
                 {
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
             return(false);
         }
         else
         {
             return(false);
         }
     }
예제 #5
0
 //yeet
 CellRow[] copyCR(CellRow[] ogboard)
 {
     CellRow[] copy = new CellRow[8];
     for (int l = 0; l < 7; l++)
     {
         CellRow ori       = ogboard[l];
         CellRow currentCR = copy[l];
         for (int k = 0; k < 7; k++)
         {
             Cell toCopy     = ori.getCell(k);
             int  toCopyType = toCopy.getType();
             Cell hi         = new Cell(toCopyType, l, k);
             copy[k] = hi;
         }
     }
     return(copy);
 }
예제 #6
0
    public void codeToGUI(CellRow[] board)
    {
        for (int i = 0; i < 8; i++)
        {
            CellRow cr = board[i];
            for (int k = 0; k < 8; k++)
            {
                Cell c        = cr.getCell(k);
                int  cellType = c.getType();
                switch (cellType)
                {
                case 1:
                    c.transform.GetChild(0).gameObject.SetActive(false);
                    break;

                case 2:
                    c.transform.GetChild(0).gameObject.SetActive(true);
                    c.transform.GetChild(0).gameObject.GetComponent <MeshRenderer>().material = materials[0];
                    break;

                case 3:
                    c.transform.GetChild(0).gameObject.SetActive(true);
                    c.transform.GetChild(0).gameObject.GetComponent <MeshRenderer>().material = materials[1];
                    break;

                case 4:
                    c.transform.GetChild(0).gameObject.SetActive(true);
                    c.transform.GetChild(0).gameObject.GetComponent <MeshRenderer>().material = materials[2];
                    break;

                case 5:
                    c.transform.GetChild(0).gameObject.SetActive(true);
                    c.transform.GetChild(0).gameObject.GetComponent <MeshRenderer>().material = materials[3];
                    break;
                }
            }
        }
    }