// Update is called once per frame
    void Update()
    {
        // if distance is less that is player over targent and this targent is not part of path but the pole of player position
        // therefore if player is over "scene" ground he can select to go to another scene
        Vector2 distanceChangable = Vector2.zero;

        if (ActualWayPoint.wayPointDirectionChoosed != null)
        {
            // if way point is point it has a game screen
            if (ActualWayPoint.waypoint == WayPointType.Point)
            {
                el.OfficialLanguageReference = ActualWayPoint.nomeUIMenuMapa;
            }

            if (ActualWayPoint.wayPointDirectionChoosed != Vector3.zero)
            {
                distanceChangable = direction = (Vector2)ActualWayPoint.wayPointDirectionChoosed - (Vector2)transform.position;
            }
        }
        if (distanceChangable.magnitude < distance && ActualWayPoint.waypoint != WayPointType.Path)
        {
            // i an over scene ground
            action = WayPointMachine.STOP;
            ActualWayPoint.wayPointDirectionChoosed = Vector3.zero;
        }
        else if (distanceChangable.magnitude < distance && ActualWayPoint.waypoint == WayPointType.Path)
        {
            if (direction.y > 0)
            {
                direction = (Vector2)ActualWayPoint.wayPointOfNortthComand.position - (Vector2)transform.position;
            }

            if (direction.y < 0)
            {
                direction = (Vector2)ActualWayPoint.wayPointOfSouthComand.position - (Vector2)transform.position;
            }

            action = WayPointMachine.WALK;
        }

        if (action == WayPointMachine.STOP)
        {
            KeyBoardInput();

            anim.SetFloat("vertical", 0);
            anim.SetFloat("horizontal", 0);
        }
        if (action == WayPointMachine.WALK)  //action real
        {
            transform.Translate(direction * velocity * Time.deltaTime);

            anim.SetFloat("vertical", direction.y);
            anim.SetFloat("horizontal", direction.x);
        }


        magnitude = distanceChangable.magnitude;
    }
    void KeyBoardInput()
    {
        float hor  = InputManager.PovHorizontal();
        float vert = InputManager.PovVertical();


        if (Input.GetKeyDown(KeyCode.UpArrow) || vert > 0)
        {
            if (ActualWayPoint.wayPointOfNortthComand != null)
            {
                ActualWayPoint.wayPointDirectionChoosed = ActualWayPoint.wayPointOfNortthComand.position;
                direction = (Vector2)ActualWayPoint.wayPointOfNortthComand.position - (Vector2)transform.position;
                action    = WayPointMachine.WALK;
            }
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow) || vert < 0)
        {
            if (ActualWayPoint.wayPointOfSouthComand != null)
            {
                ActualWayPoint.wayPointDirectionChoosed = ActualWayPoint.wayPointOfSouthComand.position;

                direction = (Vector2)ActualWayPoint.wayPointOfSouthComand.position - (Vector2)transform.position;
                action    = WayPointMachine.WALK;
            }
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow) || hor < 0)
        {
            if (ActualWayPoint.wayPointOfLeftComand != null)
            {
                ActualWayPoint.wayPointDirectionChoosed = ActualWayPoint.wayPointOfLeftComand.position;

                direction = (Vector2)ActualWayPoint.wayPointOfLeftComand.position - (Vector2)transform.position;
                action    = WayPointMachine.WALK;
            }
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow) || hor > 0)
        {
            if (ActualWayPoint.wayPointOfRightComand != null)
            {
                ActualWayPoint.wayPointDirectionChoosed = ActualWayPoint.wayPointOfRightComand.position;
                action    = WayPointMachine.WALK;
                direction = (Vector2)ActualWayPoint.wayPointOfRightComand.position - (Vector2)transform.position;
            }
        }
    }