Пример #1
0
    void MouseOver()
    {
        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, out hit, 100.0f))
        {
            if (hit.transform.gameObject.tag == "Tile")
            {
                TileScript thisTile = hit.transform.gameObject.GetComponent <TileScript>();
                thisTile.GetGrid().HighlightArea(thisTile.GetLocation());
                ToggleShipRotation(thisTile.GetGrid());
            }
        }
    }
Пример #2
0
 void MouseClick()
 {
     if (Input.GetMouseButtonDown(0))
     {
         RaycastHit hit;
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(ray, out hit, 100.0f))
         {
             if (hit.transform.gameObject.tag == "Tile")
             {
                 TileScript thisTile = hit.transform.gameObject.GetComponent <TileScript>();
                 thisTile.GetGrid().SelectArea(thisTile.GetLocation());
             }
         }
     }
 }