// Update is called once per frame
    void Update()
    {
        float step = speed * Time.deltaTime;

        if (selected)
        {
            if (dwarfcontroller.isavailable())
            {
                if (Input.GetMouseButtonDown(1))
                {
                    moveset         = true;
                    mouse_position  = Input.mousePosition;
                    mouse_positionX = mouse_position.x - Screen.width / 2;
                    mouse_positionZ = mouse_position.y - Screen.height / 2;


                    pos   = Input.mousePosition;
                    pos.z = 50;
                    pos   = Camera.main.ScreenToWorldPoint(pos);
                    //ray = new Ray(pos, Vector3.down);
                    //Debug.Log (pos);
                }
            }
        }
        if (moveset && dwarfcontroller.isawake())
        {
            transform.position = Vector3.MoveTowards(transform.position, pos, step);
        }
    }
    // Update is called once per frame
    void Update()
    {
        float step = speed * Time.deltaTime;

        if (selected)
        {
            if (dwarfcontroller.isavailable())
            {
                if (Input.GetMouseButtonDown(1))
                {
                    moveset         = true;
                    mouse_position  = Input.mousePosition;
                    mouse_positionX = mouse_position.x - Screen.width / 2;
                    mouse_positionZ = mouse_position.y - Screen.height / 2;
                    RaycastHit[] targetSelectedPlace = Physics.RaycastAll(Camera.main.ScreenPointToRay(Input.mousePosition));
                    for (int i = 0; i < targetSelectedPlace.Length; i++)
                    {
                        RaycastHit hit = targetSelectedPlace[i];
                        if (dwarfcontroller.isawake() && hit.transform.tag == "ground")
                        {
                            pos = hit.point;
                        }
                    }
                }
            }
        }
        if (moveset && dwarfcontroller.isawake())
        {
            if (dwarfcontroller.getHungerStatus() == "satieted" || dwarfcontroller.getHungerStatus() == "fine" || posSet)
            {
                transform.position = Vector3.MoveTowards(transform.position, pos, step);
                if (transform.position == pos)
                {
                    moveset = false;
                    posSet  = false;
                }
            }
        }
    }