Пример #1
0
    private void Start()
    {
        m_mxmAnimator         = m_playerTransform.GetComponentInChildren <MxMAnimator>();
        m_trajectoryGenerator = m_playerTransform.GetComponentInChildren <MxMTrajectoryGenerator>();

        m_runTagHandle    = m_mxmAnimator.CurrentAnimData.FavourTagFromName(m_runSpeedTagName);
        m_sprintTagHandle = m_mxmAnimator.CurrentAnimData.FavourTagFromName(m_sprintSpeedTagName);

        m_mxmAnimator.SetFavourMultiplier(m_favourMultiplier);
    }
Пример #2
0
    // Update is called once per frame
    public void UpdateSpeedRamp()
    {
        float inputMag = m_trajectoryGenerator.InputVector.sqrMagnitude;

        switch (m_currentSpeed)
        {
        case 0:     //Walk
        {
            if (inputMag > 0.7f * 0.7f)
            {
                m_currentSpeed = 1;
                m_mxmAnimator.AddFavourTags(m_runTagHandle);
                m_mxmAnimator.SetFavourMultiplier(m_favourMultiplier);
            }
        }
        break;

        case 1:     //Run
        {
            if (inputMag < 0.7f * 0.7f)
            {
                if (m_speedTimer < -Mathf.Epsilon)
                {
                    m_speedTimer = 0f;
                }

                m_speedTimer += Time.deltaTime;

                if (m_speedTimer > m_speedDowngradeTime)
                {
                    m_mxmAnimator.RemoveFavourTags(m_runTagHandle);
                    m_mxmAnimator.SetFavourMultiplier(m_favourMultiplier);
                    m_currentSpeed = 0;
                    m_speedTimer   = -1f;
                }
            }
        }
        break;
        }
    }