Пример #1
0
    /**
     * Called by NavigationPresenter each update cycle after a destination has been chosen
     * After calculating the position of the next set relative towards where the user is pointing
     * their device, a vibration pattern will be generated to guide them
     */
    public void SendNavigationInformation(NavigationInformation navigationInformation)
    {
        // Only start calculations when the original path is finished
        if (navigationInformation.HasPath() == false)
        {
            return;
        }

        _StartStopButton.SetActive(true);
        startedOnce = true;
        Vector2 screen = navigationInformation.Vector3ToScreenPos();
        var     tmpx   = screen.x;
        var     tmpy   = screen.y;

        float middleX = HelperFunctions.BetweenZeroAndOne(tmpx, Screen.width);
        float middleY = HelperFunctions.BetweenZeroAndOne(tmpy, Screen.height);

        float closeness = middleX;

        if (closeness >= closenessBreakpointCenter)
        {
            period = 0.1f;
        }
        else if (closeness > closenessBreakpointEdge)
        {
            period = 0.25f;
        }
        else
        {
            period = 0.5f;
        }
    }