Example #1
0
 void SelectHex()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit, layer))
         {
             Debug.Log("name " + hit.transform.name);
             if (hit.transform.GetComponent <HexController>() != null)
             {
                 if (hit.transform.gameObject != selectedHex && selectedHex != null)
                 {
                     selectedHex.GetComponent <HexController>().Fall();
                     hit.transform.GetComponent <HexController>().Rise();
                     selectedHex = hit.transform.gameObject.GetComponent <HexController>();
                     MainController.Players[0].Claim(selectedHex);
                 }
                 else if (selectedHex == null && hit.transform.gameObject != selectedHex)
                 {
                     hit.transform.GetComponent <HexController>().Rise();
                     selectedHex = hit.transform.gameObject.GetComponent <HexController>();
                 }
             }
         }
         else
         {
             selectedHex.GetComponent <HexController>().Fall();
             selectedHex = null;
         }
     }
 }
Example #2
0
 public void Claim(HexController hex)
 {
     if (expansionPoint > 10 && IsOurNeighbour(hex) == true)         //And adjacent And in limit
     {
         hex.GetComponent <HexController>().SetOwner(Id);
         HexList.Add(hex);
         DecExpansionPoint(10);
     }
 }