示例#1
0
    void MoveHorizontal()
    {
        Vector3 horizontal = new Vector3(MyInput.GetMoveX(), 0, MyInput.GetMoveZ());

        //Debug.Log ("horizontal: " + horizontal);

        if (horizontal.magnitude > 1)
        {
            horizontal.Normalize();
        }

        horizontal *= m_maxSpeed.x;

        //Debug.Log ("adjustedHorizontal: " + horizontal);

        if (horizontal.magnitude > m_maxSpeed.x * 2)
        {
            Debug.LogError("HORIZONTAL: " + horizontal);
        }

        m_impulse += horizontal;
    }