コード例 #1
0
 private void Update()
 {
     if (Input.GetMouseButtonDown(0))  //can be optimized further
     {
         //detect maze index
         Ray        ray = _mainCam.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit))
         {
             Debug.Log(hit.transform.name);
             NodeVisual nv = hit.transform.GetComponent <NodeVisual> ();
             if (nv != null)
             {
                 currentDestination = nv.GetGridPos();
                 FindPath();
             }
         }
     }
 }