예제 #1
0
 public void OnTouch(PlaceGameBoards placeGameBoards)
 {
     if (!placed && placeGameBoards.PlayTime())
     {
         placed = true;
         int color = placeGameBoards.PlayerTurn();
         placeGameBoards.UpdateChessColor(this.gameObject, color);
         if (color == 0)
         {
             this.gameObject.GetComponent <Renderer>().material = player1;
         }
         else
         {
             this.gameObject.GetComponent <Renderer>().material = player2;
         }
         bool win = placeGameBoards.CheckWin(this.gameObject, color);
         if (win)
         {
             placeGameBoards.GameOver(color);
         }
         else
         {
             placeGameBoards.UpdateTurn();
             if (placeGameBoards.Full())
             {
                 placeGameBoards.GameOver(-1);
             }
         }
     }
 }
예제 #2
0
 // Start is called before the first frame update
 void Start()
 {
     // Here we will grab the camera from the AR Session Origin.
     // This camera acts like any other camera in Unity.
     arCamera = GetComponent <ARSessionOrigin>().camera;
     // We will also need the PlaceGameBoard script to know if
     // the game board exists or not.
     placeGameBoards = GetComponent <PlaceGameBoards>();
 }