Example #1
0
    private void Update()
    {
        if (mapCreater.initMap)
        {
            if (Input.GetMouseButtonDown(0))
            {
                mapCreater.GetMapInfo().CleanShowPath();
                RaycastHit hitInfo;
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray, out hitInfo, 100))
                {
                    if (hitInfo.transform.name != "barrier(Clone)")
                    {
                        MapGridNode endNode = mapCreater.GetMapInfo().GetNodeByName(hitInfo.transform.name);


                        PathFindMgr.RequestPathFind(mapCreater.beginNode, endNode, mapCreater.GetMapInfo(), FindComplete);

                        Debug.Log("终点是:" + hitInfo.transform.name);
                    }
                }
            }
        }
    }