Esempio n. 1
0
    void MoveTo(Vector2 finalPosition, Joint leadingJoint)
    {
        //Step 1 - Move the body towards the point
        MoveBodyJointTo(finalPosition, leadingJoint);

        //Step 2 - Make the legs take a step forward if needed
        m_currentMovingFeetCount = 0;
        for (int i = 0; i < m_creature.m_feet.Count; i++)
        {
            Foot currentFoot = m_creatureFeet[i];
            if (currentFoot.isGrounded == false)
            {
                m_currentMovingFeetCount++;
                StepForward(currentFoot, finalPosition);
            }
            else if (m_currentMovingFeetCount == 0 || ((m_currentMovingFeetCount + 1) <= ((m_creatureFeet.Count / 100f) * m_percentageOfMovingFeet)))
            {
                if ((m_movingFeetPerHip[currentFoot.joint.closestBodyJoint] * 1f) / m_feetCountPerHip[currentFoot.joint.closestBodyJoint] <= 100f / m_percentageOfMovingFeet)
                {
                    if (currentFoot.ShouldTakeAStep(finalPosition, m_feetCatchUp))
                    {
                        m_currentMovingFeetCount++;
                        StepForward(currentFoot, finalPosition);
                    }
                }
            }
        }
    }