// Update is called once per frame
    void Update()
    {
        if (mode != MapClickMode.Off)
        {
            bool click = false;

            if (Input.GetMouseButtonDown(0))
            {
                Debug.Log("GetMouseButtonDown");
                clicktime = Time.time; //možný začátek kliknutí

                updateRay();
                if (Physics.Raycast(ray, out hit, Mathf.Infinity, zonePointMask))
                {
                    Debug.Log("kliknuto na point" + hit.transform.gameObject);
                    DraggedPoint = hit.transform.gameObject;
                }
            }

            if (Input.GetMouseButtonUp(0))
            {
                Debug.Log("GetMouseButtonUp");

                if (Time.time - clicktime < 0.15f && DraggedPoint == null)
                {
                    click = true;
                }

                DraggedPoint = null;
            }

            if (click || DraggedPoint != null)
            {
                updateRay();
                if (Physics.Raycast(ray, out hit, Mathf.Infinity, tarrainMask))
                {
                    /*
                     * Debug.Log(hit.point);
                     * Debug.Log("hit distance: " + hit.distance);
                     * Debug.Log(hit.collider);
                     */
                    if (click)
                    {
                        Debug.Log("Click detected");
                        if (mode == MapClickMode.Zones)
                        {
                            OnClickInZoneMode(hit.point, hit.distance);
                        }
                        if (mode == MapClickMode.WayPoints)
                        {
                            OnClickInWaypointMode(hit.point, hit.distance);
                        }
                    }

                    if (DraggedPoint != null)
                    {
                        DraggedPoint.transform.position = hit.point;
                        //ZonePointData pointScript = DraggedPoint.GetComponent("ZonePointData") as ZonePointData;
                        //pointScript.point = hit.point;
                        zoneController.OnPointDrag();
                    }
                }
            }
        }
    }