Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     //If left mouse click
     if (Input.GetMouseButtonDown(0))
     {
         //gameStateScript.GetComponent<GameStateScript>().updateGameBoard(0, turn);
         //Get mouse point
         Vector2 pos = Input.mousePosition;
         //Cast Ray
         Ray        ray = Camera.main.ScreenPointToRay(new Vector3(pos.x, pos.y, 0.0f));
         RaycastHit hit;
         //Get hit point
         if (Physics.Raycast(ray, out hit))
         {
             //change the color of the
             HexScript hex = hit.transform.gameObject.GetComponent <HexScript>();
             //Pasing by reference as increment only if we change the color
             hex.rise(ref turn);
         }
     }
 }