Ejemplo n.º 1
0
    //when a lighting cell is clicked, it will use this method to allow the currHoodle jump to it
    //destPos is the position of the chosen cell
    //row and col are the coordiantes of chosen cell
    public void LetMove(Vector3 destPos, int row, int col)
    {
        if (currHoodle != null)
        {
            BoardCells[(int)currHoodle.GetOnBoardPos()[0], (int)currHoodle.GetOnBoardPos()[1]].cellOccupied = false;
            BoardCells[row, col].cellOccupied = true;
            int playerNum = translatePlayer(currHoodle.tag.ToString());
            if (playerNum == BoardCells[row, col].occupyingPlayer)
            {
                ++arrivalCounters[playerNum];
                if (arrivalCounters[playerNum] == 15)
                {
                    gameManager.Win(currHoodle.tag.ToString());
                }
            }
            if (playerNum == BoardCells[(int)currHoodle.GetOnBoardPos()[0], (int)currHoodle.GetOnBoardPos()[1]].occupyingPlayer)
            {
                --arrivalCounters[playerNum];
            }
            currHoodle.SetCoordinate(row, col);

            //send movements according to the bounce queue
            while (BoardCells[row, col].bounceQueue.Count > 0)
            {
                int[]   nextPos = (int[])BoardCells[row, col].bounceQueue.Dequeue();
                Vector2 twodPos = BoardCells[nextPos[0], nextPos[1]].cellPos;
                currHoodle.moveQueue.Enqueue(new Vector3(twodPos.x, 0, twodPos.y));
            }
            turnOffAllPoss();
            currHoodle.NotifyMove();
            currHoodle.ResumeState();
            currHoodle = null;
        }
    }
Ejemplo n.º 2
0
 //when a hoodle is chosen, it uses this method to send request to the board for changing the currHoodle to itself
 public bool UpDateCurrHoodle(HoodleMove newCurr)
 {
     if (newCurr.tag.ToString() == colorList [currPlayer])
     {
         if (currHoodle != null && newCurr != null)
         {
             currHoodle.ResumeState();
         }
         currHoodle = newCurr;
         turnOffAllPoss();
         if (currHoodle != null)
         {
             //search for all reachable cells
             SearchMovable(currHoodle.GetOnBoardPos());
         }
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
 //when a hoodle is chosen, it uses this method to send request to the board for changing the currHoodle to itself
 public bool UpDateCurrHoodle(HoodleMove newCurr)
 {
     if (newCurr.tag.ToString() == colorList [currPlayer]) {
         if (currHoodle != null && newCurr != null)
             currHoodle.ResumeState ();
         currHoodle = newCurr;
         turnOffAllPoss ();
         if (currHoodle != null) {
             //search for all reachable cells
             SearchMovable (currHoodle.GetOnBoardPos ());
         }
         return true;
     }
     return false;
 }