Exemplo n.º 1
0
    private void VisualsAndEffectsUpdate()
    {
        // Tire positions
        SetTirePos(ref m_TireLeft, m_WheelLeftFront, m_WheelLeftBack);
        SetTirePos(ref m_TireRight, m_WheelRightFront, m_WheelRightBack);

        ParticleUpdate();

        // JumpThruster
        TransformAnimation JTanim = m_TankProperties.JumpThrusterAnimation;

        m_JumpThruster.localPosition    = JTanim.GetTranslate(m_JumpThrusterAnimationTimer) + m_JumpThrusterDefaultPos;
        m_JumpThruster.localEulerAngles = JTanim.GetEuler(m_JumpThrusterAnimationTimer);
        m_JumpThruster.localScale       = JTanim.GetScale(m_JumpThrusterAnimationTimer);

        // Camera shake on impact
        m_previousVelocity = m_currentVelocity;
        m_currentVelocity  = Vector3.Distance(Vector3.zero, Rigidbody.velocity);

        float difference = m_previousVelocity - m_currentVelocity;

        if (difference > 10)
        {
            Camera.AddScreenshake(0.02f * difference);
        }
    }