Пример #1
0
 public void Jump(float power, MotorAmountSpace powerSpace)
 {
     if (m_isGrounded)
     {
         m_jumpPower = power;
     }
     m_jumpAccePower = power;
 }
        public void Move(Vector3 velocity, Space directionSpace, MotorAmountSpace speedSpace)
        {
            float length = velocity.magnitude;         // normalization : V*length

            m_moveVelocity = velocity;
            if (directionSpace == Space.World)
            {
                m_moveVelocity = transform.InverseTransformDirection(m_moveVelocity);
            }
        }
Пример #3
0
        public void Move(Vector3 velocity, Space directionSpace, MotorAmountSpace velocitySpace)
        {
            if (velocitySpace == MotorAmountSpace.Relative)
            {
                float sp      = velocity.magnitude;
                float deltaSp = m_speed * sp;

                if (sp > 1f)
                {
                    deltaSp = sp * 0.5f * m_sprintSpeed;
                }
                if (sp > 0f)
                {
                    velocity *= deltaSp / sp;
                }
            }
            if (directionSpace == Space.World)
            {
                velocity = transform.InverseTransformDirection(velocity);
            }

            m_velocity = velocity;
        }