Пример #1
0
    /// <summary>
    /// Updates navigation state.
    /// </summary>
    public void Update()
    {
        pitch = head.transform.eulerAngles.x;
        if (pitch >= ForwardLowerBound && pitch <= ForwardUpperBound)
        {
            if (!moving)
            {
                if (EnableVibration)
                {
#if UNITY_ANDROID
                    ALPSAndroid.Vibrate(20);
#elif UNITY_WP_8_1
                    ALPSWP8.Vibrate(200);
#endif
                }

                moving = true;
            }
            controller.Move(new Vector3(head.transform.forward.x, 0, head.transform.forward.z) * Time.deltaTime * 20);
        }
        else if (pitch >= BackwardUpperBound && pitch <= BackwardLowerBound)
        {
            if (!moving)
            {
                if (EnableVibration)
                {
#if UNITY_ANDROID
                    ALPSAndroid.Vibrate(20);
#elif UNITY_WP_8_1
                    ALPSWP8.Vibrate(200);
#endif
                }
                moving = true;
            }
            controller.Move(new Vector3(-head.transform.forward.x, 0, -head.transform.forward.z) * Time.deltaTime * 20);
        }
        else
        {
            if (moving)
            {
                moving = false;
            }
        }
    }
Пример #2
0
    /// <summary>
    /// Updates navigation state.
    /// </summary>
    public void Update()
    {
        pitch = head.transform.eulerAngles.x;
        if (pitch >= ForwardLowerBound && pitch <= ForwardUpperBound)
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                if (!moving)
                {
#if UNITY_ANDROID
                    ALPSAndroid.Vibrate(20);
#endif
                    moving = true;
                }
            }
            controller.Move(new Vector3(head.transform.forward.x, 0, head.transform.forward.z) * Time.deltaTime * maxCharacterSpeed);
        }
        else if (pitch >= BackwardUpperBound && pitch <= BackwardLowerBound)
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                if (!moving)
                {
#if UNITY_ANDROID
                    ALPSAndroid.Vibrate(20);
#endif
                    moving = true;
                }
            }
            controller.Move(new Vector3(-head.transform.forward.x, 0, -head.transform.forward.z) * Time.deltaTime * maxCharacterSpeed);
        }
        else
        {
            if (Application.platform == RuntimePlatform.Android)
            {
                if (moving)
                {
                    moving = false;
                }
            }
        }
    }