Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (Ragdolled)
        {
            return;
        }

        FootLoseTimer.Update();
        FootGroundedTimer.Update();

        float heightestYFoot = 0f;

        for (int i = 0; i < legs.Length; i++)
        {
            Leg leg = legs[i];

            if (Application.isPlaying)
            {
                leg.Update();
            }

            float y = leg.Foot.position.y;

            if (i == 0 || y > heightestYFoot)
            {
                heightestYFoot = y;
            }

            if (DebugON)
            {
                leg.DebugRestrictionArea();
            }
        }

        if (CanMove)
        {
            RagdollAfterNoGroundTimer.Reset();
        }
        else
        {
            if (RagdollAfterNoGroundTimer.Update())
            {
                Ragdoll();
            }
        }
    }