Exemplo n.º 1
0
    private void HandleMove()
    {
        if (!Input.GetMouseButtonDown(0))
        {
            return;
        }

        var cameraRay = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(cameraRay, out RaycastHit hitInfo, 100, LayerMask.GetMask("Floor")))
        {
            var search = new PathSearch(transform.position, hitInfo.point, MapObj.Air | MapObj.Enemy);
            var path   = search.Solve();
            if (path != null && path.Count > 1)
            {
                StartCoroutine(SmoothMove(path));
            }
        }
    }