コード例 #1
0
ファイル: NavigationGrid.cs プロジェクト: mefist0fel/Titans
 private void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         var        ray = hitCamera.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (baseCollider.Raycast(ray, out hit, 20))
         {
             NavigationBuildPoint point = points[graph.FindNearestId(hit.point)];
             startObject.position = hit.point;
             startPoint           = point;
             TryFindPath();
         }
     }
     if (Input.GetMouseButtonDown(1))
     {
         var        ray = hitCamera.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (baseCollider.Raycast(ray, out hit, 20))
         {
             NavigationBuildPoint point = points[graph.FindNearestId(hit.point)];
             endObject.position = hit.point;
             endPoint           = point;
             TryFindPath();
         }
     }
 }