Exemplo n.º 1
0
        private Vector3 GetInputMovement(float h, float v, float r)
        {
            Vector3 movement;

            if (Camera != null)
            {
                var calculateForward = transform.forward;
                var calculateRight   = transform.right;
                if (v < 0f)
                {
                    calculateForward = Camera.forward;
                    calculateRight   = Camera.right;
                }
                m_camForward = Vector3.Scale(calculateForward, new Vector3(1, 0, 1)).normalized;
                movement     = v * m_camForward + h * calculateRight;
            }
            else
            {
                movement = v * Vector3.forward + h * Vector3.right;
            }

#if !MOBILE_INPUT
            if (!CrossPlatformInputManager.GetKey(KeyCode.LeftShift))
            {
                movement *= 0.5f;
                r        *= 0.5f;
            }
#endif
            return(movement);
        }